diff options
author | Benoit Foucher <benoit@zeroc.com> | 2015-08-20 18:15:03 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2015-08-20 18:15:03 +0200 |
commit | 00cd4748e6a82ec020d948aafc2375906803c376 (patch) | |
tree | c84ac37e120a6b6c9dbd5a0d4f842dfd827d1bab /js/src/Ice/browser/TimerUtil.js | |
parent | updating version in build instructions (diff) | |
download | ice-00cd4748e6a82ec020d948aafc2375906803c376.tar.bz2 ice-00cd4748e6a82ec020d948aafc2375906803c376.tar.xz ice-00cd4748e6a82ec020d948aafc2375906803c376.zip |
Fixed ICE-6730 - test failures on Microsoft Edge browser
Diffstat (limited to 'js/src/Ice/browser/TimerUtil.js')
-rw-r--r-- | js/src/Ice/browser/TimerUtil.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js index 96fefc87fea..518cd3c8dbc 100644 --- a/js/src/Ice/browser/TimerUtil.js +++ b/js/src/Ice/browser/TimerUtil.js @@ -10,6 +10,10 @@ // // jshint browser: true // + +/* global WorkerGlobalScope */ + + var Ice = require("../Ice/ModuleRegistry").Ice; if(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) @@ -51,14 +55,15 @@ else var _nextId = 0; - function nextId() + var nextId = function() { if(_nextId == MAX_SAFE_INTEGER) { _nextId = 0; } return _nextId++; - } + }; + Timer.setTimeout = function(cb, ms) { var id = nextId(); @@ -106,15 +111,14 @@ else { cb = _timers.delete(e.data.id); } - + if(cb !== undefined) { cb.call(); } }; - - function workerCode() + var workerCode = function() { return "(" + function() @@ -127,9 +131,9 @@ else _wSetImmediateType = 2, _wClearTimeoutType = 3, _wClearIntervalType = 4; - + var timers = {}; - + self.onmessage = function(e) { if(e.data.type == _wSetTimeoutType) @@ -163,12 +167,12 @@ else delete timers[e.data.id]; } }; - + // // jshint worker: false // }.toString() + "());"; - } + }; if(worker === undefined) { |