prepare for receiving re-analysis requests
This commit is contained in:
parent
44bca4adaa
commit
cbe7ea6042
1 changed files with 17 additions and 8 deletions
25
scripts/external/watch.js
vendored
25
scripts/external/watch.js
vendored
|
@ -24,19 +24,28 @@ export default class watch {
|
||||||
new logging((new texts(`message_external_supported`)).localized);
|
new logging((new texts(`message_external_supported`)).localized);
|
||||||
|
|
||||||
// Begin only when the page is fully loaded.
|
// Begin only when the page is fully loaded.
|
||||||
window.addEventListener(`DOMContentLoaded`, (event) => {
|
document.onreadystatechange = () => {
|
||||||
// Begin processing.
|
if (document.readyState == 'complete') {
|
||||||
let PROC = new processor(filter);
|
let PROC = new processor(filter);
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static main() {
|
static main() {
|
||||||
/* The main action. */
|
(check.platform()).then((FILTER_RESULT) => {
|
||||||
(check.platform()).then((RULES) => {
|
if (FILTER_RESULT && Object.keys(FILTER_RESULT).length > 0) {
|
||||||
if (RULES && Object.keys(RULES).length > 0) {
|
watch.process(FILTER_RESULT);
|
||||||
watch.process(RULES);
|
|
||||||
watch.callGUI();
|
watch.callGUI();
|
||||||
}
|
|
||||||
|
// Create a listener for messages indicating re-processing.
|
||||||
|
chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
|
||||||
|
// Get the tabId where this content script is running.
|
||||||
|
|
||||||
|
|
||||||
|
(((typeof message).includes(`obj`) && !Array.isArray(message)) ? message[`refresh`] : false) ? watch.process(FILTER_RESULT) : false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue