From 0d6c2bdb42a201911482b4559e13d483fa8f2061 Mon Sep 17 00:00:00 2001 From: eight Date: Sat, 1 Jun 2019 17:11:22 +0800 Subject: [PATCH] Fix: onAlarms is registered multiple times (#702) --- background/update.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/background/update.js b/background/update.js index 3276d883..2a0e02a7 100644 --- a/background/update.js +++ b/background/update.js @@ -37,6 +37,7 @@ prefs.subscribe(['updateInterval'], schedule); schedule(); + chrome.alarms.onAlarm.addListener(onAlarm); return {checkAllStyles, checkStyle, STATES}; @@ -240,10 +241,8 @@ chrome.alarms.create(ALARM_NAME, { when: Date.now() + Math.max(MIN_INTERVAL_MS, interval - elapsed), }); - chrome.alarms.onAlarm.addListener(onAlarm); } else { chrome.alarms.clear(ALARM_NAME, ignoreChromeError); - chrome.alarms.onAlarm.removeListener(onAlarm); } }