adding events is called within the builder

This commit is contained in:
buzzcode2007 2024-04-05 09:50:34 +08:00
parent 37a85f2841
commit a5256d9a21

View file

@ -15,12 +15,14 @@ async function build() {
let window = new windowman(); let window = new windowman();
window.sync(); window.sync();
events(window);
}; };
/* /*
Define the mapping of each button. Define the mapping of each button.
*/ */
function events() { function events(window) {
if (document.querySelector(`[data-action="filters,update"]`)) { if (document.querySelector(`[data-action="filters,update"]`)) {
document document
.querySelector(`[data-action="filters,update"]`) .querySelector(`[data-action="filters,update"]`)
@ -28,7 +30,7 @@ function events() {
let filters = new ( let filters = new (
await import(chrome.runtime.getURL(`scripts/filters.js`)) await import(chrome.runtime.getURL(`scripts/filters.js`))
).default(); ).default();
await filters.update(); filters.update();
}); });
} }
@ -70,12 +72,11 @@ function events() {
//main(); //main();
function load() { function load() {
build();
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
M.AutoInit(); M.AutoInit();
events();
}); });
build();
} }
load(); load();