update to the fact that filters is now a default class

This commit is contained in:
buzzcode2007 2024-04-02 15:01:39 +08:00
parent 72498563b5
commit 1bcea261fb

View file

@ -7,9 +7,7 @@ Be sensitive to changes and update the state.
let secretariat = await import( let secretariat = await import(
chrome.runtime.getURL("scripts/secretariat.js") chrome.runtime.getURL("scripts/secretariat.js")
); );
let filters = (await import(chrome.runtime.getURL("scripts/filters.js")))[ let filters = (await import(chrome.runtime.getURL("scripts/filters.js"))).default;
`filters`
];
// let reader = await import(chrome.runtime.getURL("scripts/reader.js")); // let reader = await import(chrome.runtime.getURL("scripts/reader.js"));
class watchman { class watchman {
@ -18,13 +16,11 @@ Be sensitive to changes and update the state.
@param {string} URL the page URL; default value is the current webpage @param {string} URL the page URL; default value is the current webpage
@return {dictionary} the filter to follow @return {dictionary} the filter to follow
*/ */
static observe(URL = window.location.href) { static async observe(URL = window.location.href) {
// Create the variable to determine the corresponding key. // Create the variable to determine the corresponding key.
let activity = false; let activity = false;
// let filters = secretariat.specifics(`filters`, URL);
activity = await filters.select(URL);
// Check if the filters exist.
activity = filters;
return activity; return activity;
} }
@ -49,14 +45,15 @@ Be sensitive to changes and update the state.
); );
} }
static job() { static async job() {
/* The main action. */ /* The main action. */
let job_task = watchman.observe(); (watchman.observe()).then((job_task) => {
if (job_task) { if (job_task && Object.keys(job_task).length !== 0) {
watchman.act(job_task); watchman.act(job_task);
} else { } else {
watchman.standby(); watchman.standby();
} }
});
} }
} }