From 1438a11bbfef81192e2e9aebfcbbbb81718c9e6d Mon Sep 17 00:00:00 2001 From: velzie Date: Fri, 18 Oct 2024 15:23:44 -0400 Subject: [PATCH] warn against multijetting --- src/client/client.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/client/client.ts b/src/client/client.ts index 6248a44..3ab3964 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -83,6 +83,13 @@ export class ScramjetClient { meta: URLMeta; constructor(public global: typeof globalThis) { + if (SCRAMJETCLIENT in global) { + console.error( + "attempted to initialize a scramjet client, but one is already loaded - this is very bad" + ); + throw new Error(); + } + this.serviceWorker = this.global.navigator.serviceWorker; if (iswindow) {