Files
Andy McKay 0fad0c9a4c add in a runtime example (#304)
* add in a runtime example

* updated based on feedback
2017-11-01 13:36:36 -07:00

18 lines
544 B
JavaScript

let loadTime = new Date();
let manifest = browser.runtime.getManifest();
function onInstalledNotification(details) {
browser.notifications.create('onInstalled', {
title: `Runtime Examples version: ${manifest.version}`,
message: `onInstalled has been called, background page loaded at ${loadTime.getHours()}:${loadTime.getMinutes()}`,
type: 'basic'
});
}
function onClick() {
browser.runtime.reload();
}
browser.browserAction.onClicked.addListener(onClick);
browser.runtime.onInstalled.addListener(onInstalledNotification);