fix update listening
This commit is contained in:
parent
239e86332f
commit
5e7d151cad
|
@ -10,6 +10,8 @@ export class ServiceWorkerService {
|
|||
|
||||
newAppVersionIsAvailable = new BehaviorSubject<boolean>(false);
|
||||
|
||||
private isListening = false;
|
||||
|
||||
constructor(appRef: ApplicationRef, updates: SwUpdate) {
|
||||
|
||||
//https://angular.io/guide/service-worker-communications
|
||||
|
@ -30,8 +32,14 @@ export class ServiceWorkerService {
|
|||
// });
|
||||
|
||||
const updateCheckTimer$ = interval(6 * 60 * 60 * 1000);
|
||||
updateCheckTimer$.subscribe(() => {
|
||||
updates.checkForUpdate();
|
||||
|
||||
appRef.isStable.subscribe(() => {
|
||||
if (this.isListening) return;
|
||||
this.isListening = true;
|
||||
|
||||
updateCheckTimer$.subscribe(() => {
|
||||
updates.checkForUpdate();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"background_color": "#fafafa",
|
||||
"display": "standalone",
|
||||
"scope": "/",
|
||||
"start_url": "/index.html",
|
||||
"start_url": "/",
|
||||
"icons": [
|
||||
{
|
||||
"src": "assets/icons/icon-72x72.png",
|
||||
|
|
Loading…
Reference in New Issue