diff options
author | 2021-08-31 23:07:03 -0700 | |
---|---|---|
committer | 2021-08-31 23:07:03 -0700 | |
commit | e2b9f232315fde2f47e0d55fb01f9f214ac2b3d3 (patch) | |
tree | 72aa3ca7dce78f2377b1c9d40771f42383b2f766 /src/fallback.ts | |
parent | 78e1144ca52723571c5e59f2c990a8902e1f7c0b (diff) | |
download | bun-e2b9f232315fde2f47e0d55fb01f9f214ac2b3d3.tar.gz bun-e2b9f232315fde2f47e0d55fb01f9f214ac2b3d3.tar.zst bun-e2b9f232315fde2f47e0d55fb01f9f214ac2b3d3.zip |
Add display name field to frameworks, improve logging, add counters, add
Former-commit-id: b2cf011b6c6405a786fe22367e1cd4e6c2c4c90f
Diffstat (limited to 'src/fallback.ts')
-rw-r--r-- | src/fallback.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/fallback.ts b/src/fallback.ts index cf4195c4d..ae969062c 100644 --- a/src/fallback.ts +++ b/src/fallback.ts @@ -6,10 +6,9 @@ import { } from "./api/schema"; function getFallbackInfo(): FallbackMessageContainer { - var binary_string = window.atob( - document.querySelector("#__bunfallback").textContent.trim() + var binary_string = globalThis.atob( + document.getElementById("#__bunfallback").textContent.trim() ); - document.querySelector("#__bunfallback").remove(); var len = binary_string.length; var bytes = new Uint8Array(len); @@ -21,4 +20,10 @@ function getFallbackInfo(): FallbackMessageContainer { } globalThis.__BUN_DATA__ = getFallbackInfo(); -document.getElementById("__bun_fallback_script")?.remove(); +// It's probably better to remove potentially large content from the DOM when not in use +if ("requestIdleCallback" in globalThis) { + globalThis.requestIdleCallback(() => { + document.getElementById("__bunfallback")?.remove(); + document.getElementById("__bun_fallback_script")?.remove(); + }); +} |