attempt: make main function async to make refresh function available anytime

This commit is contained in:
buzz-lightsnack-2007 2024-05-07 16:33:05 +08:00
parent c0e2152806
commit b935ab7dc9

View file

@ -23,8 +23,9 @@ export default class watch {
} }
} }
static main() { static async main() {
(check.platform()).then((FILTER_RESULT) => { let FILTER_RESULT = await check.platform();
if (FILTER_RESULT && Object.keys(FILTER_RESULT).length > 0) { if (FILTER_RESULT && Object.keys(FILTER_RESULT).length > 0) {
// Let user know that the website is supported, if ever they have opened the console. // Let user know that the website is supported, if ever they have opened the console.
new logging((new texts(`message_external_supported`)).localized); new logging((new texts(`message_external_supported`)).localized);
@ -33,10 +34,10 @@ export default class watch {
// Create a listener for messages indicating re-processing. // Create a listener for messages indicating re-processing.
chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { 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; (((typeof message).includes(`obj`) && !Array.isArray(message)) ? message[`refresh`] : false)
? watch.process(FILTER_RESULT, {"override": true})
: false;
}); });
} }
});
} }
} }