From 585f559a1dbfc6effb460ece3c28d91d02a31472 Mon Sep 17 00:00:00 2001 From: Eason Wong Date: Mon, 28 Aug 2023 05:03:24 +0200 Subject: [PATCH] Update v1.1 --- background.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/background.js b/background.js index dfa74a0..180f4ca 100644 --- a/background.js +++ b/background.js @@ -11,15 +11,15 @@ const update_debounce = addDebounce(update); var updateToggle = true; var updateInterval = setInterval(update, 2500); -browser.runtime.onMessage.addListener(controller); -browser.runtime.onMessageExternal.addListener(controller); +browser.runtime.onMessage.addListener(onMessage); +browser.runtime.onMessageExternal.addListener(onMessage); -function controller(message) { +function onMessage(message) { switch (message) { case "TPOH_ON": clearInterval(updateInterval); updateToggle = true; - setTimeout(update_debounce, 100); + update_debounce(); updateInterval = setInterval(update, 2500); break; case "TPOH_OFF": @@ -27,7 +27,7 @@ function controller(message) { updateToggle = false; break; case "TPOH_UPDATE": - if (updateToggle) setTimeout(update_debounce, 100); + /* if (updateToggle) update_debounce(); */ break; default: break;