UNPKG

@blynx/inject

Version:
34 lines (33 loc) 902 B
Object.defineProperty(exports, "__esModule", { value: true }); /** * js-injectable helper * * @export * @class Injector */ var Injector = /** @class */ (function () { function Injector() { } /** * Instantiate a class decorated with Injectable * * @static * @template T Type of class * @param {{new(...args: any[]): T}} newType The class to instantiate * @param {...any[]} args Arguments, use for excluded injectables * @returns {T} New instance of T * * @memberOf Injector */ Injector.inject = function (newType) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } var _a; var result = new ((_a = newType).bind.apply(_a, [void 0].concat(args)))(); return result; }; return Injector; }()); exports.Injector = Injector;