JavaScript Sending NotificationJun 2021
featured image
if (!('Notification' in window)){
  // browser does not support
  return;
}

if (Notification.permission === 'granted'){
  // Permission already granted
  new Notification('Hello there!');
} else {
  // We have to get permission first
  Notification.requestPermission()
    .then(status => {
      if (status === 'granted') {
        // Show notification now
      }
    })
}