Skip to content
Snippets Groups Projects
Commit 9a697181 authored by Cheng Shao's avatar Cheng Shao :beach:
Browse files

wasm: fix dyld setImmediate usage in browser

The wasm dyld script used to only run in node and directly uses
setImmediate in globalThis. In case of browsers, it needs to import
setImmediate from the prelude, hence this commit.
parent 929df0ba
No related branches found
No related tags found
No related merge requests found
......@@ -93,7 +93,7 @@ import fs from "node:fs";
import path from "node:path";
import stream from "node:stream";
import { WASI } from "node:wasi";
import { JSValManager } from "./prelude.mjs";
import { JSValManager, setImmediate } from "./prelude.mjs";
import { parseRecord, parseSections } from "./post-link.mjs";
// Make a consumer callback from a buffer. See Parser class
......
......@@ -39,7 +39,7 @@ export class JSValManager {
// To benchmark different setImmediate() implementations in the
// browser, use https://github.com/jphpsf/setImmediate-shim-demo as a
// starting point.
const setImmediate = await (async () => {
export const setImmediate = await (async () => {
// node, bun, or other scripts might have set this up in the browser
if (globalThis.setImmediate) {
return globalThis.setImmediate;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment