Detect updates
This commit is contained in:
		@@ -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()))
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user