summaryrefslogtreecommitdiff
path: root/js/src/Ice/browser/TimerUtil.js
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-09-21 17:40:50 +0200
committerJose <jose@zeroc.com>2015-09-21 17:40:50 +0200
commitaab3ae3aaef1ca00f8e347d97230c6a54b3bf1d7 (patch)
treea7ee147f593f05cc1845c9639c19e60f09c7fb22 /js/src/Ice/browser/TimerUtil.js
parentTravis CI Updates (diff)
downloadice-aab3ae3aaef1ca00f8e347d97230c6a54b3bf1d7.tar.bz2
ice-aab3ae3aaef1ca00f8e347d97230c6a54b3bf1d7.tar.xz
ice-aab3ae3aaef1ca00f8e347d97230c6a54b3bf1d7.zip
ICE-6634 - Using Ice in background worker.
Diffstat (limited to 'js/src/Ice/browser/TimerUtil.js')
-rw-r--r--js/src/Ice/browser/TimerUtil.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js
index 5d9d498cd3d..698350d9dc5 100644
--- a/js/src/Ice/browser/TimerUtil.js
+++ b/js/src/Ice/browser/TimerUtil.js
@@ -17,9 +17,9 @@
var Ice = require("../Ice/ModuleRegistry").Ice;
//
-// Create a timer object that uses the default browser methods. Note that we also
-// have to use apply with null as the first argument to workaround an issue where
-// IE doesn't like these functions to be called with an unknown object (it reports
+// Create a timer object that uses the default browser methods. Note that we also
+// have to use apply with null as the first argument to workaround an issue where
+// IE doesn't like these functions to be called with an unknown object (it reports
// an "Invalid calling object" error).
//
function createTimerObject()
@@ -29,11 +29,12 @@ function createTimerObject()
Timer.clearTimeout = function () { clearTimeout.apply(null, arguments); };
Timer.setInterval = function () { setInterval.apply(null, arguments); };
Timer.clearInterval = function () { clearInterval.apply(null, arguments); };
- Timer.setImmediate = function () { setImmediate.apply(null, arguments); };
+ Timer.setImmediate = typeof(setImmediate) == "function" ?
+ function () { setImmediate.apply(null, arguments); } : function() { setTimeout.apply(null, arguments); };
return Timer;
}
-if(typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobalScope)
+if(typeof(WorkerGlobalScope) !== 'undefined' && this instanceof WorkerGlobalScope)
{
//
// If running in a worker we don't need to create a separate worker for the timers