import { Component } from '@angular/core'; import { RouterOutlet } from '@angular/router'; import { SwUpdate } from '@angular/service-worker'; import { NotificationsService } from './services/notifications.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], standalone: true, imports: [RouterOutlet] }) export class AppComponent { constructor( private readonly _swUpdate: SwUpdate, private _notifications: NotificationsService ) { this._swUpdate.versionUpdates.subscribe((evt) => { console.log('Version update', evt); if (evt.type === 'VERSION_READY') { this._swUpdate.activateUpdate().then(() => { this._notifications.add({ text: "New version available. DiunaBI will restart in 10 seconds.", duration: 10000, dismiss: () => { window.location.reload() }, btn: 'Cancel', action: () => { this._notifications.add({ text: "Restart canceled.", btn: "Hide" }); } }) }); } }) } }