-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmainThread.js
More file actions
45 lines (38 loc) · 1.03 KB
/
mainThread.js
File metadata and controls
45 lines (38 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// mainThread.js
let permanentModule2Load=[
];
// Load all relevant settings from storage
for (let i = 0; i < permanentModule2Load.length; i++) {
const moduleName = permanentModule2Load[i];
import('./modules/' + moduleName + '.js')
.then(module => {
if (module.initializeMT) {
module.initializeMT();
console.log(moduleName)
}
})
.catch(err => {
console.error('Error loading ' + moduleName + ':', err);
});
}
window.addEventListener("moduleMT2Load", function(items) {
let extensionId=items.detail.extensionId;
items=items.detail.modules;
moules2Load=Object.keys(items)
for (let i = 0; i < moules2Load.length; i++) {
const moduleName = moules2Load[i];
// Check if the module is enabled (i.e., true) before loading
if (items[moduleName]) {
import('./modules/' + moduleName + '.js')
.then(module => {
if (module.initializeMT) {
module.initializeMT(extensionId);
//console.log(moduleName)
}
})
.catch(err => {
console.error('Error loading ' + moduleName + ':', err);
});
}
}
});