monaco-editor
Version:
A browser based code editor
31 lines (30 loc) • 1.3 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ServiceCollection = /** @class */ (function () {
function ServiceCollection() {
var entries = [];
for (var _i = 0; _i < arguments.length; _i++) {
entries[_i] = arguments[_i];
}
this._entries = new Map();
for (var _a = 0, entries_1 = entries; _a < entries_1.length; _a++) {
var _b = entries_1[_a], id = _b[0], service = _b[1];
this.set(id, service);
}
}
ServiceCollection.prototype.set = function (id, instanceOrDescriptor) {
var result = this._entries.get(id);
this._entries.set(id, instanceOrDescriptor);
return result;
};
ServiceCollection.prototype.has = function (id) {
return this._entries.has(id);
};
ServiceCollection.prototype.get = function (id) {
return this._entries.get(id);
};
return ServiceCollection;
}());
export { ServiceCollection };