From 3b780309931547203cb6e2b495c1a69930808546 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 3 Apr 2017 14:35:39 +0200 Subject: [PATCH] Remove request manager (use event manager) --- Message/Request/RequestManager.js | 117 ------------------------------ 1 file changed, 117 deletions(-) delete mode 100644 Message/Request/RequestManager.js diff --git a/Message/Request/RequestManager.js b/Message/Request/RequestManager.js deleted file mode 100644 index 4a5e509..0000000 --- a/Message/Request/RequestManager.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Request manager class. - * - * Used for pooling requests. - * - * @author OMS Development Team - * @author Dennis Eichhorn - * @copyright 2013 Dennis Eichhorn - * @license OMS License 1.0 - * @version 1.0.0 * @since 1.0.0 - */ -(function (jsOMS) -{ - "use strict"; - - /** @namespace jsOMS.Message.Request */ - jsOMS.Autoloader.defineNamespace('jsOMS.Message.Request'); - - /** - * @constructor - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - jsOMS.Message.Request.RequestManager = function () - { - this.groups = {}; - this.callbacks = {}; - }; - - /** - * Add request group. - * - * @return {string} id Request id - * @return {string} group Group id - * - * @method - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - jsOMS.Message.Request.RequestManager.prototype.addGroup = function (id, group) - { - if (typeof this.groups[group] === 'undefined') { - this.groups[group] = {}; - } - - this.groups[group][id] = false; - }; - - /** - * Group has outstanding/pending requests? - * - * @return {string} group Group id - * - * @return {boolean} - * - * @method - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - jsOMS.Message.Request.RequestManager.prototype.hasOutstanding = function (group) - { - if (typeof this.groups[group] === 'undefined') { - return false; - } - - for (let id in this.groups[group]) { - if (!this.groups[group][id]) { - return true; - } - } - - return false; - }; - - /** - * Mark request as done. - * - * @return {string} id Request id - * @return {string} group Group id - * - * @method - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - jsOMS.Message.Request.RequestManager.prototype.triggerDone = function (id, group) - { - if (typeof this.groups[group] !== 'undefined') { - this.groups[group][id] = true; - } - - if (!this.hasOutstanding(group)) { - this.callbacks[group](); - delete this.callbacks[group]; - delete this.groups[group]; - } - }; - - /** - * Create callback for request pool. - * - * @return {string} group Group id - * @return {function} callback Callback - * - * @method - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - jsOMS.Message.Request.RequestManager.prototype.setDone = function (group, callback) - { - this.callbacks[group] = callback; - }; -}(window.jsOMS = window.jsOMS || {}));