From 67afe41531c8dfb18cc27e68b93c70252cd43a5a Mon Sep 17 00:00:00 2001 From: Angelo Verlain Date: Tue, 12 Nov 2024 20:07:01 +0200 Subject: [PATCH] chore: don't globalise fetch --- src/muse.ts | 3 ++- src/polyfills/fetch.ts | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/muse.ts b/src/muse.ts index 46d0ede9..1aa83bbc 100644 --- a/src/muse.ts +++ b/src/muse.ts @@ -6,7 +6,6 @@ import { Headers } from "headers-polyfill"; globalThis.Headers = Headers; // Headers -import "./polyfills/fetch.js"; // base64 import "./polyfills/base64.js"; @@ -20,7 +19,9 @@ import "./polyfills/abortcontroller.js"; import { setup } from "libmuse"; import { MuzikaSecretStore } from "./util/secret-store.js"; +import { fetch } from "./polyfills/fetch.js"; setup({ store: new MuzikaSecretStore(), + fetch: fetch as unknown as typeof globalThis.fetch, }); diff --git a/src/polyfills/fetch.ts b/src/polyfills/fetch.ts index a40a9dda..d8be852a 100644 --- a/src/polyfills/fetch.ts +++ b/src/polyfills/fetch.ts @@ -303,6 +303,3 @@ export async function fetch(url: string | URL, options: FetchOptions = {}) { return response; } - -// @ts-expect-error setting a global -window.fetch = fetch;