@@ -30,16 +30,20 @@ function wrap (func, wrapper) {
3030
3131process . nextTick = wrapWithActivateUvLoop ( process . nextTick )
3232
33- global . setImmediate = wrapWithActivateUvLoop ( timers . setImmediate )
33+ global . setImmediate = timers . setImmediate = wrapWithActivateUvLoop ( timers . setImmediate )
3434global . clearImmediate = timers . clearImmediate
3535
36+ // setTimeout needs to update the polling timeout of the event loop, when
37+ // called under Chromium's event loop the node's event loop won't get a chance
38+ // to update the timeout, so we have to force the node's event loop to
39+ // recalculate the timeout in browser process.
40+ timers . setTimeout = wrapWithActivateUvLoop ( timers . setTimeout )
41+ timers . setInterval = wrapWithActivateUvLoop ( timers . setInterval )
42+
43+ // Only override the global setTimeout/setInterval impls in the browser process
3644if ( process . type === 'browser' ) {
37- // setTimeout needs to update the polling timeout of the event loop, when
38- // called under Chromium's event loop the node's event loop won't get a chance
39- // to update the timeout, so we have to force the node's event loop to
40- // recalculate the timeout in browser process.
41- global . setTimeout = wrapWithActivateUvLoop ( timers . setTimeout )
42- global . setInterval = wrapWithActivateUvLoop ( timers . setInterval )
45+ global . setTimeout = timers . setTimeout
46+ global . setInterval = timers . setInterval
4347}
4448
4549if ( process . platform === 'win32' ) {
0 commit comments