fix: add properties and methods to go wasm middleware, accessed via reflection

This commit is contained in:
Derrick Hammer 2023-06-24 04:11:37 -04:00
parent 2aa53faf00
commit 53dd352c95
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 11 additions and 0 deletions

View File

@ -82,6 +82,7 @@ export default class Go {
private exited = false;
private _resolveCallbackPromise?: () => void;
importObject: ImportObject;
private _pendingEvent?: any;
constructor() {
this._callbackTimeouts = new Map();
@ -437,6 +438,16 @@ export default class Go {
}
this._inst.exports.resume();
}
_makeFuncWrapper(id) {
const go = this;
return function () {
const event = { id: id, this: this, args: arguments };
go._pendingEvent = event;
go._resume();
// @ts-ignore
return event.result;
};
}
}
if (