From 398f81bbedd4c273f1b3438210fcacfb69aa93a8 Mon Sep 17 00:00:00 2001 From: N/Ame <173015200+grqz@users.noreply.github.com> Date: Wed, 22 Oct 2025 12:14:14 +1300 Subject: [PATCH] Use a local `window` variable (#9) --- src/yt/solver/setup.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/yt/solver/setup.ts b/src/yt/solver/setup.ts index f0b3324..445644c 100644 --- a/src/yt/solver/setup.ts +++ b/src/yt/solver/setup.ts @@ -4,11 +4,9 @@ export const setupNodes = parse(` if (typeof globalThis.XMLHttpRequest === "undefined") { globalThis.XMLHttpRequest = { prototype: {} }; } -if (typeof globalThis.window === "undefined") { - globalThis.window = Object.create(null); -} +const window = Object.create(null); if (typeof URL === "undefined") { - globalThis.window.location = { + window.location = { hash: "", host: "www.youtube.com", hostname: "www.youtube.com", @@ -22,7 +20,7 @@ if (typeof URL === "undefined") { username: "", }; } else { - globalThis.window.location = new URL("https://www.youtube.com/watch?v=yt-dlp-wins"); + window.location = new URL("https://www.youtube.com/watch?v=yt-dlp-wins"); } if (typeof globalThis.document === "undefined") { globalThis.document = Object.create(null);