initial commit

This commit is contained in:
Niels Kooiman
2019-08-12 12:52:12 +02:00
parent cc94057ac7
commit 352211dfcf
29 changed files with 2303 additions and 11 deletions

31
dist/PortResolver.js vendored Normal file
View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PortResolver = /** @class */ (function () {
function PortResolver() {
this._container = {};
}
PortResolver.prototype.register = function (name, fn) {
this._container[name] = fn;
};
PortResolver.prototype.registerInstance = function (name, fn) {
var _instance = null;
var getInstance = function (fn) {
return function () {
if (!_instance) {
_instance = fn();
}
return _instance;
};
};
this._container[name] = getInstance(fn);
};
PortResolver.prototype.resolve = function (name) {
if (name in this._container && typeof this._container[name] == 'function') {
return this._container[name]();
}
throw new Error('PortResolver can not resolve ' + name);
};
return PortResolver;
}());
exports.PortResolver = PortResolver;
//# sourceMappingURL=PortResolver.js.map