Skip to content

Instantly share code, notes, and snippets.

@tomnagengast
Last active August 9, 2017 19:11
Show Gist options
  • Save tomnagengast/bf10812e4cc4bc825c657d4e5a7abc6c to your computer and use it in GitHub Desktop.
Save tomnagengast/bf10812e4cc4bc825c657d4e5a7abc6c to your computer and use it in GitHub Desktop.
/**
* Fires the web notification api.
*/
if(window.Notification && Notification.permission !== "denied") {
// status is "granted", if accepted by user
Notification.requestPermission(function(status) {
let notify = new Notification('Title', {
body: 'I am the body text!',
// optional
icon: '/path/to/icon.png'
});
// close the notification
notify.close();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment