Last active
August 9, 2017 19:11
-
-
Save tomnagengast/bf10812e4cc4bc825c657d4e5a7abc6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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