Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // func scheduleTimeoutEvent(delay int64) int32
- "runtime.scheduleTimeoutEvent": (sp) => {
- sp >>>= 0;
- const id = this._nextCallbackTimeoutID;
- this._nextCallbackTimeoutID++;
- this._scheduledTimeouts.set(id, setTimeout(
- () => {
- console.log("###### TRIGGER TIMEOUT EVENT", (this._scheduledTimeouts.get(id))[Symbol.toPrimitive]());
- this._resume();
- while (this._scheduledTimeouts.has(id)) {
- // for some reason Go failed to register the timeout event, log and try again
- // (temporary workaround for https://github.com/golang/go/issues/28975)
- console.warn("scheduleTimeoutEvent: missed timeout event");
- this._resume();
- }
- },
- getInt64(sp + 8),
- ));
- console.log("###### SCHEDULE TIMEOUT EVENT", (this._scheduledTimeouts.get(id))[Symbol.toPrimitive](), getInt64(sp + 8));
- this.mem.setInt32(sp + 16, id, true);
- },
- // func clearTimeoutEvent(id int32)
- "runtime.clearTimeoutEvent": (sp) => {
- sp >>>= 0;
- const id = this.mem.getInt32(sp + 8, true);
- console.log("###### CLEAR TIMEOUT EVENT", (this._scheduledTimeouts.get(id))[Symbol.toPrimitive]());
- clearTimeout(this._scheduledTimeouts.get(id));
- this._scheduledTimeouts.delete(id);
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement