misc fixes

This commit is contained in:
velzie 2024-08-03 11:20:15 -04:00
parent 7e8e9990f4
commit a58f9bcb63
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
6 changed files with 26 additions and 8 deletions

View file

@ -8,6 +8,8 @@ export const isworker = "WorkerGlobalScope" in self;
export const issw = "ServiceWorkerGlobalScope" in self;
export const isdedicated = "DedicatedWorkerGlobalScope" in self;
export const isshared = "SharedWorkerGlobalScope" in self;
export const isemulatedsw =
new URL(self.location.href).searchParams.get("dest") === "serviceworker";
dbg.log("scrammin");
// if it already exists, that means the handlers have probably already been setup by the parent document
@ -15,9 +17,7 @@ if (!(ScramjetClient.SCRAMJET in self)) {
const client = new ScramjetClient(self);
client.hook();
if (
new URL(self.location.href).searchParams.get("dest") === "serviceworker"
) {
if (isemulatedsw) {
const runtime = new ScramjetServiceWorkerRuntime(client);
runtime.hook();
}