Skip to content

Instantly share code, notes, and snippets.

@huchenme
Created July 8, 2019 06:50
Show Gist options
  • Save huchenme/17415a4521f5e6d524fd08da4c7afd32 to your computer and use it in GitHub Desktop.
Save huchenme/17415a4521f5e6d524fd08da4c7afd32 to your computer and use it in GitHub Desktop.
medium background script v1
chrome.runtime.onInstalled.addListener(() => {
console.log('onInstalled...');
// create alarm after extension is installed / upgraded
chrome.alarms.create('refresh', { periodInMinutes: 3 });
});
chrome.alarms.onAlarm.addListener((alarm) => {
console.log(alarm.name); // refresh
helloWorld();
});
function helloWorld() {
console.log("Hello, world!");
}
@huchenme
Copy link
Author

huchenme commented Jul 7, 2020

@atomauro chrome is available for Chrome and Firefox, where are you getting this error? If it is eslint you should ignore it. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onInstalled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment