Skip to content

Commit c531e59

Browse files
committed
web: update wasm_exec.js
1 parent 6e5baea commit c531e59

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

web/public/wasm_exec.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
if (!globalThis.fs) {
1515
let outputBuf = "";
1616
globalThis.fs = {
17-
constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused
17+
constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1, O_DIRECTORY: -1 }, // unused
1818
writeSync(fd, buf) {
1919
outputBuf += decoder.decode(buf);
2020
const nl = outputBuf.lastIndexOf("\n");
@@ -73,6 +73,14 @@
7373
}
7474
}
7575

76+
if (!globalThis.path) {
77+
globalThis.path = {
78+
resolve(...pathSegments) {
79+
return pathSegments.join("/");
80+
}
81+
}
82+
}
83+
7684
if (!globalThis.crypto) {
7785
throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
7886
}
@@ -208,10 +216,16 @@
208216
return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));
209217
}
210218

219+
const testCallExport = (a, b) => {
220+
this._inst.exports.testExport0();
221+
return this._inst.exports.testExport(a, b);
222+
}
223+
211224
const timeOrigin = Date.now() - performance.now();
212225
this.importObject = {
213226
_gotest: {
214227
add: (a, b) => a + b,
228+
callExport: testCallExport,
215229
},
216230
gojs: {
217231
// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)

0 commit comments

Comments
 (0)