fix(background): fix background script init
This commit is contained in:
parent
dd95d5a0ac
commit
d97dc9da87
|
@ -2,6 +2,8 @@ import { REFRESH_TIMEOUT, HOMEPAGE, API_URLS, BADGE_COLORS } from './config.js';
|
|||
// [INJECT-BROWSER-POLYFILL]
|
||||
|
||||
browser.runtime.onInstalled.addListener(async (details) => {
|
||||
init();
|
||||
|
||||
if (details.reason === 'install') {
|
||||
await browser.tabs.create({
|
||||
url: HOMEPAGE,
|
||||
|
@ -9,6 +11,10 @@ browser.runtime.onInstalled.addListener(async (details) => {
|
|||
}
|
||||
});
|
||||
|
||||
browser.runtime.onStartup.addListener(async () => {
|
||||
init();
|
||||
});
|
||||
|
||||
browser.alarms.onAlarm.addListener((alarm) => {
|
||||
if (alarm.name === 'fetchData') {
|
||||
fetchNewData();
|
||||
|
@ -107,5 +113,3 @@ function init() {
|
|||
periodInMinutes: REFRESH_TIMEOUT,
|
||||
});
|
||||
}
|
||||
|
||||
init();
|
||||
|
|
Loading…
Reference in New Issue