import { AbstractNotificationService } from './abstract-notification.service' ; export class DesktopNotificationService implements AbstractNotificationService { showError ( title , message , icon ? ) { this . showNotification ( 'Error' , title , message , icon ) ; } showInfo ( title , message , icon ? ) { this . showNotification ( 'Info' , title , message , icon ) ; } showWait ( title , message , icon ? ) { this . showNotification ( 'Wait' , title , message , icon ) ; } showSuccess ( title , message , icon ? ) { this . showNotification ( 'Success' , title , message , icon ) ; } showWarning ( title , message , icon ? ) { this . showNotification ( 'Warning' , title , message , icon ) ; } private showNotification ( type , title , message , icon ? ) { if ( ! Notification ) { alert ( 'Desktop notifications not available in your browser. Try Chromium.' ) ; return ; } const messageBody = { } ; messageBody . body = message ; if ( icon ) { messageBody . icon = icon ; } const titleToShow = `${ type } : ${ title }` ; Notification . requestPermission ( ) . then ( ( ) => { const myNotification = new Notification ( titleToShow , messageBody ) ; } ) ; } }