Skip to content

Commit

Permalink
Move main loop handling code to library_eventloop.js. NFC (#22615)
Browse files Browse the repository at this point in the history
This means that programs that use the main event loops don't need to
depend on the `Browser` object.

We already supported and test the main loops handling code on node, but
programs that only use the event loop without any other `Browser`
functions no longer need to pull in the whole `Browser` object.
  • Loading branch information
sbc100 authored Sep 25, 2024
1 parent d5fba03 commit 52cc139
Show file tree
Hide file tree
Showing 14 changed files with 422 additions and 410 deletions.
8 changes: 4 additions & 4 deletions src/library_async.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ addToLibrary({
#endif
Asyncify.state = Asyncify.State.Rewinding;
runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData));
if (typeof Browser != 'undefined' && Browser.mainLoop.func) {
Browser.mainLoop.resume();
if (typeof MainLoop != 'undefined' && MainLoop.func) {
MainLoop.resume();
}
var asyncWasmReturnValue, isError = false;
try {
Expand Down Expand Up @@ -391,8 +391,8 @@ addToLibrary({
#if ASYNCIFY_DEBUG
dbg(`ASYNCIFY: start unwind ${Asyncify.currData}`);
#endif
if (typeof Browser != 'undefined' && Browser.mainLoop.func) {
Browser.mainLoop.pause();
if (typeof MainLoop != 'undefined' && MainLoop.func) {
MainLoop.pause();
}
runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData));
}
Expand Down
Loading

0 comments on commit 52cc139

Please sign in to comment.