Detect updates

This commit is contained in:
Zakary Timson 2019-08-24 19:30:18 -04:00
parent b40ced8ece
commit bce4e9a96e

View File

@ -1,7 +1,13 @@
import { Component } from '@angular/core';
import {MatSnackBar} from "@angular/material/snack-bar";
import {SwUpdate} from "@angular/service-worker";
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent { }
export class AppComponent {
constructor(private snackbar: MatSnackBar, private update: SwUpdate) {
update.available.subscribe(() => snackbar.open('Update Available!! 🚀', 'Reload').onAction().subscribe(() => update.activateUpdate()))
}
}