MCPcopy
hub / github.com/webpack/webpack / _load

Method _load

test/helpers/FakeDocument.js:235–251  ·  view source on GitHub ↗

* @param {FakeElement} node node to load * @returns {void}

(node)

Source from the content-addressed store, hash-verified

233 * @returns {void}
234 */
235 _load(node) {
236 if (node._type === "link") {
237 const timer = setTimeout(() => {
238 const loadEvent = { type: "load", target: node };
239 if (node.onload) node.onload(loadEvent);
240 node._dispatchEvent(loadEvent);
241 }, 100);
242 // Don't let this cosmetic load timer keep the worker's event loop alive
243 // past teardown (Deno's setTimeout returns a number, hence the guard).
244 if (typeof timer.unref === "function") timer.unref();
245 } else if (node._type === "script" && this._document.onScript) {
246 Promise.resolve().then(() => {
247 /** @type {(src: string | undefined) => void} */
248 (this._document.onScript)(node.src);
249 });
250 }
251 }
252
253 /**
254 * @param {FakeElement} node node to insert

Callers 3

insertBeforeMethod · 0.95
appendChildMethod · 0.95
test.config.jsFile · 0.80

Calls 2

_dispatchEventMethod · 0.80
resolveMethod · 0.65

Tested by

no test coverage detected