/ packages / frontend / src / happyDomSetup.ts
happyDomSetup.ts
 1  import { GlobalRegistrator } from "@happy-dom/global-registrator";
 2  
 3  // Store deno's web APIs and reassign them after happydom is registered
 4  const denoAbortController = globalThis.AbortController;
 5  const denoBlob = globalThis.Blob;
 6  const denoFetch = globalThis.fetch;
 7  const denoFile = globalThis.File;
 8  const denoFileReader = globalThis.FileReader;
 9  const denoFormData = globalThis.FormData;
10  const denoHeaders = globalThis.Headers;
11  const denoRequest = globalThis.Request;
12  const denoResponse = globalThis.Response;
13  const denoWritableStream = globalThis.WritableStream;
14  const denoReadableStream = globalThis.ReadableStream;
15  
16  GlobalRegistrator.register();
17  
18  globalThis.AbortController = denoAbortController;
19  globalThis.Blob = denoBlob;
20  globalThis.fetch = denoFetch;
21  globalThis.File = denoFile;
22  globalThis.FileReader = denoFileReader;
23  globalThis.FormData = denoFormData;
24  globalThis.Headers = denoHeaders;
25  globalThis.Request = denoRequest;
26  globalThis.Response = denoResponse;
27  globalThis.WritableStream = denoWritableStream;
28  globalThis.ReadableStream = denoReadableStream;