Skip to content

Instantly share code, notes, and snippets.

@sowbug
Created April 25, 2014 19:38
Show Gist options
  • Save sowbug/11300656 to your computer and use it in GitHub Desktop.
Save sowbug/11300656 to your computer and use it in GitHub Desktop.
A different way of letting users know that your Chrome extension or app has been installed/updated
chrome.runtime.onInstalled.addListener(function() {
var options = {
type: "basic",
title: "Version " +
chrome.runtime.getManifest().version +
" installed",
message: "Just thought you'd like to know that this extension is now installed!",
iconUrl: "assets/icon_128.png"
};
// In a real extension or app, you'd examine the current version and
// compare it to the last time you displayed the message.
var shouldDisplayInstallationMessage = true;
if (shouldDisplayInstallationMessage) {
chrome.notifications.create("my_id", options, function(id) {
console.log("created", id);
});
}
});
{
"manifest_version": 2,
"name": "Hello World",
"version": "1.2.3.4",
"icons": {
"16": "assets/icon_16.png",
"128": "assets/icon_128.png"
},
"permissions": [
"notifications"
],
"background": {
"scripts": ["event.js"],
"persistent": false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment