* @param {FakeElement} node node to load * @returns {void}
(node)
| 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 |
no test coverage detected