From: Cheng Zhao Date: Thu, 7 Aug 2014 02:37:00 +0000 (+0800) Subject: Force updating timeout when setTimeout is called, fixes #481. X-Git-Tag: v0.15.4~5 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=d29efb7f81811e48bd7d84da26a6d93d9f90e245;p=electron.git Force updating timeout when setTimeout is called, fixes #481. --- diff --git a/atom/common/lib/init.coffee b/atom/common/lib/init.coffee index 5da02744..0d5e8e6b 100644 --- a/atom/common/lib/init.coffee +++ b/atom/common/lib/init.coffee @@ -25,3 +25,10 @@ wrapWithActivateUvLoop = (func) -> process.nextTick = wrapWithActivateUvLoop process.nextTick global.setImmediate = wrapWithActivateUvLoop timers.setImmediate 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