diff --git a/src/go_wasm.ts b/src/go_wasm.ts index f026813..58ed239 100644 --- a/src/go_wasm.ts +++ b/src/go_wasm.ts @@ -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 (