import { Injectable } from '@angular/core'; import { Resolve } from '@angular/router'; import { ServiceWorkerService } from '@core/services/service-worker.service'; import { environment } from '@environment'; @Injectable({ providedIn: 'root' }) export class ServiceWorkerUpdateResolver implements Resolve { constructor ( private swService: ServiceWorkerService ) { } // block any subsequent parts of the app from loading until we've checked for an update async resolve () { if (environment.production) { this.swService.startPolling(); this.swService.checkForUpdate(); } } }