Skip to content

Commit

Permalink
More use of expectToReceiveOnModule in library_browser.js. NFC (#21224)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed Feb 1, 2024
1 parent 449c94f commit 2e77af2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/library_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,37 @@ var LibraryBrowser = {
Browser.mainLoop.scheduler();
},
updateStatus() {
#if expectToReceiveOnModule('setStatus')
if (Module['setStatus']) {
var message = Module['statusMessage'] || 'Please wait...';
var remaining = Browser.mainLoop.remainingBlockers;
var expected = Browser.mainLoop.expectedBlockers;
if (remaining) {
if (remaining < expected) {
Module['setStatus'](message + ' (' + (expected - remaining) + '/' + expected + ')');
Module['setStatus'](`{message} ({expected - remaining}/{expected})`);
} else {
Module['setStatus'](message);
}
} else {
Module['setStatus']('');
}
}
#endif
},
runIter(func) {
if (ABORT) return;
#if expectToReceiveOnModule('preMainLoop')
if (Module['preMainLoop']) {
var preRet = Module['preMainLoop']();
if (preRet === false) {
return; // |return false| skips a frame
}
}
#endif
callUserCallback(func);
#if expectToReceiveOnModule('postMainLoop')
Module['postMainLoop']?.();
#endif
}
},
isFullscreen: false,
Expand Down

0 comments on commit 2e77af2

Please sign in to comment.