To show desktop notifications we use the Notification API:

  1. Asking the user for permission to show notifications.
  2. Show notifications to the user by creating Notification object.

var noti = new Notification(title, options);

Asking for user permission:

Notification.requestPermission(permission => {

ย  ย  if(permission=='granted') {

ย  ย  ย  ย  //show notification

ย  ย  }

});

Creating Notification to show:

const myNoti = new Notification('Notification Title', {

ย  ย  body: 'This is my notification',

ย  ย  icon: 'ICON_URL',

ย  ย  image: 'IMAGE_URL'

});