We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fcf73c commit aefa478Copy full SHA for aefa478
src/lib/libeventloop.js
@@ -135,11 +135,16 @@ LibraryJSEventLoop = {
135
{{{ runtimeKeepalivePop() }}}
136
callUserCallback(() => {
137
if ({{{ makeDynCall('idp', 'cb') }}}(t, userData)) {
138
+ {{{ runtimeKeepalivePush() }}}
139
// Save a little bit of code space: modern browsers should treat
140
// negative setTimeout as timeout of 0
141
// (https://stackoverflow.com/questions/8430966/is-calling-settimeout-with-a-negative-delay-ok)
- {{{ runtimeKeepalivePush() }}}
142
- setTimeout(tick, n - _emscripten_get_now());
+ var remaining = n - _emscripten_get_now()
143
+#if ENVIRONMENT_MAY_BE_NODE
144
+ // Recent revsions of node, however, give TimeoutNegativeWarning
145
+ remaining = Math.max(0, remaining);
146
+#endif
147
+ setTimeout(tick, remaining);
148
}
149
});
150
0 commit comments