diff options
author | Jose <jose@zeroc.com> | 2018-04-30 21:10:23 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-04-30 21:10:23 +0200 |
commit | 530608e4ce63dd36d1659b58d1a3fb7fdcf56bea (patch) | |
tree | b5195405b16dd31ac1c486daf7f3ff2572ce6499 /js/src/Ice/browser/TimerUtil.js | |
parent | Allow FileParser.Endpoints to be set via Ice::Properties (#58) (diff) | |
download | ice-530608e4ce63dd36d1659b58d1a3fb7fdcf56bea.tar.bz2 ice-530608e4ce63dd36d1659b58d1a3fb7fdcf56bea.tar.xz ice-530608e4ce63dd36d1659b58d1a3fb7fdcf56bea.zip |
Fix JavaScript errors and warnings report by ESLINT
Close #28
Diffstat (limited to 'js/src/Ice/browser/TimerUtil.js')
-rw-r--r-- | js/src/Ice/browser/TimerUtil.js | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js index 54388e04c66..abe9ddfde97 100644 --- a/js/src/Ice/browser/TimerUtil.js +++ b/js/src/Ice/browser/TimerUtil.js @@ -27,44 +27,40 @@ function createTimerObject() { static setTimeout(cb, ms) { - return setTimeout.apply(null, arguments); + return setTimeout(cb, ms); } static clearTimeout(id) { - return clearTimeout.apply(null, arguments); + return clearTimeout(id); } - static setInterval() + static setInterval(cb, ms) { - return setInterval.apply(null, arguments); + return setInterval(cb, ms); } - static clearInterval() + static clearInterval(id) { - return clearInterval.apply(null, arguments); + return clearInterval(id); } - }; - if(typeof(setImmediate) == "function") - { - Timer.setImmediate = function() - { - return setImmediate.apply(null, arguments); - }; - } - else - { - Timer.setImmediate = function() + static setImmediate(cb) { - return setTimeout.apply(null, arguments); - }; - } - + if(typeof setImmediate == "function") + { + return setImmediate(cb); + } + else + { + return setTimeout(cb); + } + } + }; return Timer; } -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; const _timers = new Map(); @@ -204,7 +200,7 @@ else if(typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobal } else if(worker === undefined) { - const url = URL.createObjectURL(new Blob([workerCode()], {type : 'text/javascript'})); + const url = URL.createObjectURL(new Blob([workerCode()], {type: 'text/javascript'})); worker = new Worker(url); worker.onmessage = Timer.onmessage; Ice.Timer = Timer; |