From b935ab7dc906d7434aa0c47ac0df416ea839280c Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Tue, 7 May 2024 16:33:05 +0800 Subject: [PATCH] attempt: make main function async to make refresh function available anytime --- scripts/external/watch.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/scripts/external/watch.js b/scripts/external/watch.js index beccb21..b08e5c4 100644 --- a/scripts/external/watch.js +++ b/scripts/external/watch.js @@ -23,20 +23,21 @@ export default class watch { } } - static main() { - (check.platform()).then((FILTER_RESULT) => { - if (FILTER_RESULT && Object.keys(FILTER_RESULT).length > 0) { - // Let user know that the website is supported, if ever they have opened the console. - new logging((new texts(`message_external_supported`)).localized); + static async main() { + let FILTER_RESULT = await check.platform(); - watch.process(FILTER_RESULT); - - // Create a listener for messages indicating re-processing. - chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { - (((typeof message).includes(`obj`) && !Array.isArray(message)) ? message[`refresh`] : false) ? watch.process(FILTER_RESULT, {"override": true}) : false; - }); - } - }); + if (FILTER_RESULT && Object.keys(FILTER_RESULT).length > 0) { + // Let user know that the website is supported, if ever they have opened the console. + new logging((new texts(`message_external_supported`)).localized); + watch.process(FILTER_RESULT); + + // Create a listener for messages indicating re-processing. + chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { + (((typeof message).includes(`obj`) && !Array.isArray(message)) ? message[`refresh`] : false) + ? watch.process(FILTER_RESULT, {"override": true}) + : false; + }); + } } } \ No newline at end of file