MCPcopy Create free account
hub / github.com/melonjs/melonJS / DOMContentLoaded

Function DOMContentLoaded

packages/melonjs/src/system/dom.ts:10–23  ·  view source on GitHub ↗
(fn: () => void)

Source from the content-addressed store, hash-verified

8 * @ignore
9 */
10export const DOMContentLoaded = (fn: () => void) => {
11 if (
12 nodeJS ||
13 typeof globalThis.document === "undefined" ||
14 globalThis.document.readyState !== "loading"
15 ) {
16 // DOM already ready (or no DOM environment), defer to next microtask
17 void Promise.resolve().then(fn);
18 } else {
19 globalThis.document.addEventListener("DOMContentLoaded", fn, {
20 once: true,
21 });
22 }
23};

Callers 2

index.tsFile · 0.90
onReadyFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected