only read data if auto run is enabled

This commit is contained in:
buzz-lightsnack-2007 2024-05-01 19:10:11 +08:00
parent 72733aa21b
commit b61100af02

View file

@ -6,7 +6,7 @@ import check from "/scripts/external/check.js";
import processor from "/scripts/external/processor.js"; import processor from "/scripts/external/processor.js";
import logging from "/scripts/logging.js"; import logging from "/scripts/logging.js";
import texts from "/scripts/mapping/read.js"; import texts from "/scripts/mapping/read.js";
import {read} from "/scripts/secretariat.js"; import {global} from "/scripts/secretariat.js";
export default class watch { export default class watch {
/* Open relevant graphical user interfaces. /* Open relevant graphical user interfaces.
@ -19,13 +19,13 @@ export default class watch {
@param {dictionary} filter the filter to work with @param {dictionary} filter the filter to work with
*/ */
static process(filter) { static async process(filter) {
// 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);
// Begin only when the page is fully loaded. document.onreadystatechange = async () => {
document.onreadystatechange = () => { if (document.readyState == 'complete' && await global.read([`settings`, `behavior`, `autoRun`])) {
if (document.readyState == 'complete') { console.log(`Loading complete, processing…`);
let PROC = new processor(filter); let PROC = new processor(filter);
} }
}; };