Created
May 7, 2015 19:27
-
-
Save mobarrio/986b5b6876041c04fafa to your computer and use it in GitHub Desktop.
Web Notifications API
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
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