Created
June 28, 2014 20:30
-
-
Save dmitryTsatsarin/d683678202788d8474be to your computer and use it in GitHub Desktop.
Google chrome notification api example
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
// Dmitry Tsatsarin | |
/* Attention!!!! | |
Required fields: | |
iconUrl, | |
type, | |
title, | |
message | |
iconUrl MUST BE(!!!!!) valid url or empty string | |
*/ | |
function getNotificationId() { | |
var id = Math.floor(Math.random() * 9007199254740992) + 1; | |
return id.toString(); | |
} | |
var notificationId = getNotificationId(); | |
var options = { | |
iconUrl: 'img/icon128.png', | |
type: 'basic', | |
title: 'titlle', | |
message: 'message' | |
}; | |
chrome.notifications.create(notificationId, options, function(notificationId){ | |
console.log('Notification resut'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment