]> git.wh0rd.org - chrome-ext/clearhistory-advance-fork.git/blobdiff - javascript/clearhistory.js
fix timer init
[chrome-ext/clearhistory-advance-fork.git] / javascript / clearhistory.js
index 7c9596f943ec287b28890ce8dd026176be9cb587..d05a2f694f9581438c57bcad119b50bd9d354583 100644 (file)
@@ -119,10 +119,15 @@ chrome.browserAction.onClicked.addListener(function(tab) {
   runCleaner();
 });
 
-chrome.alarms.create(CONSTANTS.CLEANER_ALARM, {
-  // First fire 10 minutes from now.
-  'when': Date.now() + (10 * 60 * 1000),
-  'periodInMinutes': 24 * 60
+chrome.alarms.get(CONSTANTS.CLEANER_ALARM, function(a) {
+  if (a)
+    return;
+
+  chrome.alarms.create(CONSTANTS.CLEANER_ALARM, {
+    // First fire 10 minutes from now.
+    'when': Date.now() + (10 * 60 * 1000),
+    'periodInMinutes': 24 * 60
+  });
 });
 
 chrome.alarms.onAlarm.addListener(function(alarm) {