Force updating timeout when setTimeout is called, fixes #481.

This commit is contained in:
Cheng Zhao 2014-08-07 10:37:00 +08:00
parent 53cedc6e5d
commit d29efb7f81

View file

@ -25,3 +25,10 @@ wrapWithActivateUvLoop = (func) ->
process.nextTick = wrapWithActivateUvLoop process.nextTick process.nextTick = wrapWithActivateUvLoop process.nextTick
global.setImmediate = wrapWithActivateUvLoop timers.setImmediate global.setImmediate = wrapWithActivateUvLoop timers.setImmediate
global.clearImmediate = timers.clearImmediate global.clearImmediate = timers.clearImmediate
# setTimeout needs to update the polling timeout of the event loop, when called
# under Chromium's event loop the node's event loop won't get a chance to update
# the timeout, so we have to force the node's event loop to recalculate the
# timeout in browser process.
if process.type is 'browser'
global.setTimeout = wrapWithActivateUvLoop timers.setTimeout