@methodus/platform-rest
Version:
REST plugin for methodus
42 lines • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Clients = exports.ClientList = void 0;
var uuid_1 = require("uuid");
var ClientList = (function () {
function ClientList() {
this.instances = {};
this.instances = {};
this.clients = {};
this.serversArray = [];
}
ClientList.prototype.addServer = function (server) {
var id = uuid_1.v1();
this.instances[id] = server;
return id;
};
ClientList.prototype.set = function (instanceId, serverType, instance) {
this.instances[instanceId][serverType] = instance;
this.serversArray.push(instance);
return instance;
};
ClientList.prototype.get = function (instanceId, serverType) {
if (serverType) {
return this.instances[instanceId][serverType];
}
else {
return this.instances[instanceId];
}
};
ClientList.prototype.reset = function () {
this.instances = {};
this.serversArray = [];
global.METHODUS_BRIDGE = new ClientList();
};
return ClientList;
}());
exports.ClientList = ClientList;
if (!global.METHODUS_BRIDGE) {
global.METHODUS_BRIDGE = new ClientList();
}
exports.Clients = global.METHODUS_BRIDGE;
//# sourceMappingURL=clients-list.js.map