All files / src/services service-worker.service.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17    16x       15x 8x   7x       15x      
export class ServiceWorkerService {
  static Instantiate() {
    return new ServiceWorkerService();
  }
 
  async getRegistration(): Promise<ServiceWorkerRegistration | undefined> {
    if (ServiceWorkerService.canServiceWork()) {
      return await navigator.serviceWorker.getRegistration('/app');
    }
    return undefined;
  }
 
  private static canServiceWork(): boolean {
    return 'serviceWorker' in navigator;
  }
}