diff options
author | Jose <jose@zeroc.com> | 2014-09-02 14:22:34 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2014-09-02 14:22:34 +0200 |
commit | fef794cdd1f8eb698fa3ccfe6f4cacba88030e9d (patch) | |
tree | 8e0c3c353dbbaa57d60a1da49c13b4153e918763 /js/src/Ice/RetryQueue.js | |
parent | Fix (ICE-3445) - consider not installing internal header files (diff) | |
download | ice-fef794cdd1f8eb698fa3ccfe6f4cacba88030e9d.tar.bz2 ice-fef794cdd1f8eb698fa3ccfe6f4cacba88030e9d.tar.xz ice-fef794cdd1f8eb698fa3ccfe6f4cacba88030e9d.zip |
Fixed (ICE-5654) - Update JS mapping to not use global types in NodeJS
Diffstat (limited to 'js/src/Ice/RetryQueue.js')
-rw-r--r-- | js/src/Ice/RetryQueue.js | 121 |
1 files changed, 57 insertions, 64 deletions
diff --git a/js/src/Ice/RetryQueue.js b/js/src/Ice/RetryQueue.js index e24ff18b347..100941670b9 100644 --- a/js/src/Ice/RetryQueue.js +++ b/js/src/Ice/RetryQueue.js @@ -7,77 +7,70 @@ // // ********************************************************************** -(function(global){ - require("Ice/Class"); - require("Ice/Debug"); - require("Ice/LocalException"); +var Ice = require("../Ice/ModuleRegistry").Ice; +Ice.__M.require(module, "Ice", ["../Ice/Class", "../Ice/LocalException"]); - var Ice = global.Ice || {}; +var Class = Ice.Class; - var Debug = Ice.Debug; - - var Class = Ice.Class; - - var RetryQueue = Class({ - __init__: function(instance) - { - this._instance = instance; - this._requests = []; - }, - add: function(outAsync, interval) - { - var task = new RetryTask(this, outAsync); - this._instance.timer().schedule(function() - { - task.run(); - }, interval); - this._requests.push(task); - }, - destroy: function() - { - for(var i = 0; i < this._requests.length; ++i) +var RetryQueue = Class({ + __init__: function(instance) + { + this._instance = instance; + this._requests = []; + }, + add: function(outAsync, interval) + { + var task = new RetryTask(this, outAsync); + this._instance.timer().schedule(function() { - this._requests[i].destroy(); - } - this._requests = []; - }, - remove: function(task) + task.run(); + }, interval); + this._requests.push(task); + }, + destroy: function() + { + for(var i = 0; i < this._requests.length; ++i) { - var idx = this._requests.indexOf(task); - if(idx >= 0) - { - this._requests.splice(idx, 1); - return true; - } - return false; + this._requests[i].destroy(); } - }); - Ice.RetryQueue = RetryQueue; - - var RetryTask = Class({ - __init__: function(queue, outAsync, interval) + this._requests = []; + }, + remove: function(task) + { + var idx = this._requests.indexOf(task); + if(idx >= 0) { - this.queue = queue; - this.outAsync = outAsync; - }, - run: function() + this._requests.splice(idx, 1); + return true; + } + return false; + } +}); +Ice.RetryQueue = RetryQueue; + +var RetryTask = Class({ + __init__: function(queue, outAsync, interval) + { + this.queue = queue; + this.outAsync = outAsync; + }, + run: function() + { + if(this.queue.remove(this)) { - if(this.queue.remove(this)) + try { - try - { - this.outAsync.__invoke(); - } - catch(ex) - { - this.outAsync.__invokeException(ex); - } + this.outAsync.__invoke(); + } + catch(ex) + { + this.outAsync.__invokeException(ex); } - }, - destroy: function() - { - this.outAsync.__invokeException(new Ice.CommunicatorDestroyedException()); } - }); - global.Ice = Ice; -}(typeof (global) === "undefined" ? window : global)); + }, + destroy: function() + { + this.outAsync.__invokeException(new Ice.CommunicatorDestroyedException()); + } +}); +module.exports.Ice = Ice; |