Skip to content

Commit 11f454c

Browse files
authored
Move safeSetTimeout to library_eventloop.js. NFC (#20269)
1 parent 0be5b60 commit 11f454c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/library.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3460,16 +3460,6 @@ addToLibrary({
34603460
},
34613461
#endif // MINIMAL_RUNTIME
34623462

3463-
$safeSetTimeout__deps: ['$callUserCallback'],
3464-
$safeSetTimeout__docs: '/** @param {number=} timeout */',
3465-
$safeSetTimeout: (func, timeout) => {
3466-
{{{ runtimeKeepalivePush() }}}
3467-
return setTimeout(() => {
3468-
{{{ runtimeKeepalivePop() }}}
3469-
callUserCallback(func);
3470-
}, timeout);
3471-
},
3472-
34733463
$asmjsMangle: (x) => {
34743464
var unmangledSymbols = {{{ buildStringArray(WASM_SYSTEM_EXPORTS) }}};
34753465
if (x == '__main_argc_argv') {

src/library_eventloop.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ LibraryJSEventLoop = {
1111
throw 'unwind';
1212
},
1313

14+
$safeSetTimeout__deps: ['$callUserCallback'],
15+
$safeSetTimeout__docs: '/** @param {number=} timeout */',
16+
$safeSetTimeout: (func, timeout) => {
17+
{{{ runtimeKeepalivePush() }}}
18+
return setTimeout(() => {
19+
{{{ runtimeKeepalivePop() }}}
20+
callUserCallback(func);
21+
}, timeout);
22+
},
23+
1424
// Just like setImmediate but returns an i32 that can be passed back
1525
// to wasm rather than a JS object.
1626
$setImmediateWrapped: (func) => {

0 commit comments

Comments
 (0)