Fix: onAlarms is registered multiple times (#702)
This commit is contained in:
parent
60693e8c3f
commit
0d6c2bdb42
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
prefs.subscribe(['updateInterval'], schedule);
|
prefs.subscribe(['updateInterval'], schedule);
|
||||||
schedule();
|
schedule();
|
||||||
|
chrome.alarms.onAlarm.addListener(onAlarm);
|
||||||
|
|
||||||
return {checkAllStyles, checkStyle, STATES};
|
return {checkAllStyles, checkStyle, STATES};
|
||||||
|
|
||||||
|
@ -240,10 +241,8 @@
|
||||||
chrome.alarms.create(ALARM_NAME, {
|
chrome.alarms.create(ALARM_NAME, {
|
||||||
when: Date.now() + Math.max(MIN_INTERVAL_MS, interval - elapsed),
|
when: Date.now() + Math.max(MIN_INTERVAL_MS, interval - elapsed),
|
||||||
});
|
});
|
||||||
chrome.alarms.onAlarm.addListener(onAlarm);
|
|
||||||
} else {
|
} else {
|
||||||
chrome.alarms.clear(ALARM_NAME, ignoreChromeError);
|
chrome.alarms.clear(ALARM_NAME, ignoreChromeError);
|
||||||
chrome.alarms.onAlarm.removeListener(onAlarm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user