]> khamidou — GitHub mirrors - electron.git/commitdiff
Set global.setImmediate
authorCheng Zhao <zcbenz@gmail.com>
Mon, 14 Sep 2015 08:25:43 +0000 (16:25 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 14 Sep 2015 08:25:43 +0000 (16:25 +0800)
atom/common/lib/init.coffee

index 48f06b93f65916241fc90a54eb1a1fd9d5eae443..cde0ea3075f5fbc1030c80128dd200372db082ca 100644 (file)
@@ -38,10 +38,15 @@ wrapWithActivateUvLoop = (func) ->
     func.apply this, arguments
 process.nextTick = wrapWithActivateUvLoop process.nextTick
 
-# 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'
+  # 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.
   global.setTimeout = wrapWithActivateUvLoop timers.setTimeout
   global.setInterval = wrapWithActivateUvLoop timers.setInterval
+else
+  # There are no setImmediate under renderer process by default, so we need to
+  # manually setup them here.
+  global.setImmediate = setImmediate
+  global.clearImmediate = clearImmediate