Skip to content

Instantly share code, notes, and snippets.

@dmitryTsatsarin
Created June 28, 2014 20:30
Show Gist options
  • Save dmitryTsatsarin/d683678202788d8474be to your computer and use it in GitHub Desktop.
Save dmitryTsatsarin/d683678202788d8474be to your computer and use it in GitHub Desktop.
Google chrome notification api example
// 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