mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 23:30:00 -04:00
fix postmessage proxy
This commit is contained in:
parent
a29e8c42a3
commit
b8334993ae
5 changed files with 34 additions and 8 deletions
|
@ -63,17 +63,30 @@ export class ScramjetClient {
|
|||
recursive: true,
|
||||
});
|
||||
|
||||
let modules = [];
|
||||
|
||||
for (const key of context.keys()) {
|
||||
const module = context(key);
|
||||
if (!key.endsWith(".ts")) continue;
|
||||
if (
|
||||
(key.startsWith("./dom/") && "window" in self) ||
|
||||
(key.startsWith("./worker/") && "WorkerGlobalScope" in self) ||
|
||||
key.startsWith("./shared/")
|
||||
) {
|
||||
const module = context(key);
|
||||
module.default(this, this.global);
|
||||
modules.push(module);
|
||||
}
|
||||
}
|
||||
|
||||
modules.sort((a, b) => {
|
||||
const aorder = a.order || 0;
|
||||
const border = b.order || 0;
|
||||
|
||||
return aorder - border;
|
||||
});
|
||||
|
||||
for (const module of modules) {
|
||||
module.default(this, this.global);
|
||||
}
|
||||
}
|
||||
|
||||
Proxy(name: string | string[], handler: Proxy) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue