Skip to content

Instantly share code, notes, and snippets.

@mobarrio
Created May 7, 2015 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mobarrio/986b5b6876041c04fafa to your computer and use it in GitHub Desktop.
Save mobarrio/986b5b6876041c04fafa to your computer and use it in GitHub Desktop.
Web Notifications API
if(window.Notification && Notification.permission !== "denied") {
Notification.requestPermission(function(status) { // status is "granted", if accepted by user
var n = new Notification('Title', { body: 'I am the body text!' });
n.onshow = function () {
setTimeout(n.close(), 5000);
}
});
}
Fuente: http://davidwalsh.name/notifications-api
Fuente: https://developer.mozilla.org/en-US/docs/Web/API/Notification/Using_Web_Notifications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment