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 fc15522 commit e884357Copy full SHA for e884357
src/lib/libeventloop.js
@@ -135,11 +135,17 @@ LibraryJSEventLoop = {
135
{{{ runtimeKeepalivePop() }}}
136
callUserCallback(() => {
137
if ({{{ makeDynCall('idp', 'cb') }}}(t, userData)) {
138
+ {{{ runtimeKeepalivePush() }}}
139
+#if ENVIRONMENT_MAY_BE_NODE
140
+ var remaining = Math.max(0, n - _emscripten_get_now())
141
+#else
142
// Save a little bit of code space: modern browsers should treat
143
// negative setTimeout as timeout of 0
144
// (https://stackoverflow.com/questions/8430966/is-calling-settimeout-with-a-negative-delay-ok)
- {{{ runtimeKeepalivePush() }}}
- setTimeout(tick, n - _emscripten_get_now());
145
+ // Node, however, gives TimeoutNegativeWarning
146
+ var remaining = n - _emscripten_get_now()
147
+#endif
148
+ setTimeout(tick, remaining);
149
}
150
});
151
0 commit comments