mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
fix: make window check more robust and cleanup wasm and cookie once scramjet is done initializing
This commit is contained in:
parent
80592c81a7
commit
e149e4af22
1 changed files with 3 additions and 1 deletions
|
@ -6,7 +6,7 @@ import { ScramjetClient } from "./client";
|
|||
import { ScramjetContextInit } from "./events";
|
||||
import { ScramjetServiceWorkerRuntime } from "./swruntime";
|
||||
|
||||
export const iswindow = "window" in self;
|
||||
export const iswindow = "window" in self && window instanceof Window;
|
||||
export const isworker = "WorkerGlobalScope" in self;
|
||||
export const issw = "ServiceWorkerGlobalScope" in self;
|
||||
export const isdedicated = "DedicatedWorkerGlobalScope" in self;
|
||||
|
@ -34,6 +34,8 @@ if (!(SCRAMJETCLIENT in <Partial<typeof self>>self)) {
|
|||
client.frame?.dispatchEvent(ev);
|
||||
}
|
||||
|
||||
Reflect.deleteProperty(self, "WASM");
|
||||
Reflect.deleteProperty(self, "COOKIE");
|
||||
if ("document" in self && document?.currentScript) {
|
||||
document.currentScript.remove();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue