Skip to content

Commit

Permalink
fix(fetch): use globalThis instead of window for Deno compat
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Oct 21, 2024
1 parent 9281e02 commit 77dd1c3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .changeset/wicked-rules-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@whatwg-node/fetch': patch
---

Use \`globalThis\` instead of \`window\` for the global object reference

Fixes the issues with Deno
39 changes: 19 additions & 20 deletions packages/fetch/dist/esm-ponyfill.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
const fetch = window.fetch;
const Headers = window.Headers;
const Request = window.Request;
const Response = window.Response;
const FormData = window.FormData;
const ReadableStream = window.ReadableStream;
const WritableStream = window.WritableStream;
const TransformStream = window.TransformStream;
const CompressionStream = window.CompressionStream;
const DecompressionStream = window.DecompressionStream;
const Blob = window.Blob;
const File = window.File;
const crypto = window.crypto;
const btoa = window.btoa;
const TextEncoder = window.TextEncoder;
const TextDecoder = window.TextDecoder;
const URLPattern = window.URLPattern;
const URL = window.URL;
const URLSearchParams = window.URLSearchParams;

const fetch = globalThis.fetch;
const Headers = globalThis.Headers;
const Request = globalThis.Request;
const Response = globalThis.Response;
const FormData = globalThis.FormData;
const ReadableStream = globalThis.ReadableStream;
const WritableStream = globalThis.WritableStream;
const TransformStream = globalThis.TransformStream;
const CompressionStream = globalThis.CompressionStream;
const DecompressionStream = globalThis.DecompressionStream;
const Blob = globalThis.Blob;
const File = globalThis.File;
const crypto = globalThis.crypto;
const btoa = globalThis.btoa;
const TextEncoder = globalThis.TextEncoder;
const TextDecoder = globalThis.TextDecoder;
const URLPattern = globalThis.URLPattern;
const URL = globalThis.URL;
const URLSearchParams = globalThis.URLSearchParams;

export {
fetch,
Expand Down

0 comments on commit 77dd1c3

Please sign in to comment.