From: Cheng Zhao Date: Thu, 7 Aug 2014 06:23:28 +0000 (+0800) Subject: Also fix setInterval for #481. X-Git-Tag: v0.15.4~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=382dbb500cf3c7a01f5b210d2399ddc79abc8bf0;p=electron.git Also fix setInterval for #481. --- diff --git a/atom/common/lib/init.coffee b/atom/common/lib/init.coffee index 0d5e8e6b..0b4b2c22 100644 --- a/atom/common/lib/init.coffee +++ b/atom/common/lib/init.coffee @@ -32,3 +32,4 @@ global.clearImmediate = timers.clearImmediate # timeout in browser process. if process.type is 'browser' global.setTimeout = wrapWithActivateUvLoop timers.setTimeout + global.setInterval = wrapWithActivateUvLoop timers.setInterval diff --git a/spec/node-spec.coffee b/spec/node-spec.coffee index e05aac7d..19fe1e09 100644 --- a/spec/node-spec.coffee +++ b/spec/node-spec.coffee @@ -69,6 +69,13 @@ describe 'node feature', -> it 'can be scheduled in time', (done) -> remote.getGlobal('setTimeout')(done, 0) + describe 'setInterval called under Chromium event loop in browser process', -> + it 'can be scheduled in time', (done) -> + clear = -> + remote.getGlobal('clearInterval')(interval) + done() + interval = remote.getGlobal('setInterval')(clear, 0) + describe 'message loop', -> describe 'process.nextTick', -> it 'emits the callback', (done) ->