Comparing version 4.10.0 to 4.11.0
@@ -12,2 +12,10 @@ define(["require", "exports", "../utils/guid"], function (require, exports, guid_1) { | ||
exports.ContainerModule = ContainerModule; | ||
var AsyncContainerModule = (function () { | ||
function AsyncContainerModule(registry) { | ||
this.guid = guid_1.guid(); | ||
this.registry = registry; | ||
} | ||
return AsyncContainerModule; | ||
}()); | ||
exports.AsyncContainerModule = AsyncContainerModule; | ||
}); |
@@ -0,1 +1,36 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
define(["require", "exports", "../bindings/binding", "../constants/error_msgs", "../constants/literal_types", "../constants/metadata_keys", "../planning/metadata_reader", "../planning/planner", "../resolution/resolver", "../syntax/binding_to_syntax", "../utils/guid", "../utils/serialization", "./container_snapshot", "./lookup"], function (require, exports, binding_1, ERROR_MSGS, literal_types_1, METADATA_KEY, metadata_reader_1, planner_1, resolver_1, binding_to_syntax_1, guid_1, serialization_1, container_snapshot_1, lookup_1) { | ||
@@ -57,3 +92,2 @@ "use strict"; | ||
Container.prototype.load = function () { | ||
var _this = this; | ||
var modules = []; | ||
@@ -63,37 +97,36 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
var setModuleId = function (bindingToSyntax, moduleId) { | ||
bindingToSyntax._binding.moduleId = moduleId; | ||
}; | ||
var getBindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var bindingToSyntax = _this.bind.call(_this, serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
var getUnbindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _unbind = _this.unbind.bind(_this); | ||
_unbind(serviceIdentifier); | ||
}; | ||
}; | ||
var getIsboundFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _isBound = _this.isBound.bind(_this); | ||
return _isBound(serviceIdentifier); | ||
}; | ||
}; | ||
var getRebindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var bindingToSyntax = _this.rebind.call(_this, serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
modules.forEach(function (module) { | ||
var bindFunction = getBindFunction(module.guid); | ||
var unbindFunction = getUnbindFunction(module.guid); | ||
var isboundFunction = getIsboundFunction(module.guid); | ||
var rebindFunction = getRebindFunction(module.guid); | ||
module.registry(bindFunction, unbindFunction, isboundFunction, rebindFunction); | ||
var getHelpers = this._getContainerModuleHelpersFactory(); | ||
for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) { | ||
var currentModule = modules_1[_a]; | ||
var containerModuleHelpers = getHelpers(currentModule.guid); | ||
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction); | ||
} | ||
}; | ||
Container.prototype.loadAsync = function () { | ||
var modules = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
modules[_i] = arguments[_i]; | ||
} | ||
return __awaiter(this, void 0, void 0, function () { | ||
var getHelpers, _a, modules_2, currentModule, containerModuleHelpers; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
getHelpers = this._getContainerModuleHelpersFactory(); | ||
_a = 0, modules_2 = modules; | ||
_b.label = 1; | ||
case 1: | ||
if (!(_a < modules_2.length)) return [3, 4]; | ||
currentModule = modules_2[_a]; | ||
containerModuleHelpers = getHelpers(currentModule.guid); | ||
return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)]; | ||
case 2: | ||
_b.sent(); | ||
_b.label = 3; | ||
case 3: | ||
_a++; | ||
return [3, 1]; | ||
case 4: return [2]; | ||
} | ||
}); | ||
}); | ||
@@ -209,2 +242,42 @@ }; | ||
}; | ||
Container.prototype._getContainerModuleHelpersFactory = function () { | ||
var _this = this; | ||
var setModuleId = function (bindingToSyntax, moduleId) { | ||
bindingToSyntax._binding.moduleId = moduleId; | ||
}; | ||
var getBindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _bind = _this.bind.bind(_this); | ||
var bindingToSyntax = _bind(serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
var getUnbindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _unbind = _this.unbind.bind(_this); | ||
_unbind(serviceIdentifier); | ||
}; | ||
}; | ||
var getIsboundFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _isBound = _this.isBound.bind(_this); | ||
return _isBound(serviceIdentifier); | ||
}; | ||
}; | ||
var getRebindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _rebind = _this.rebind.bind(_this); | ||
var bindingToSyntax = _rebind(serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
return function (mId) { return ({ | ||
bindFunction: getBindFunction(mId), | ||
isboundFunction: getIsboundFunction(mId), | ||
rebindFunction: getRebindFunction(mId), | ||
unbindFunction: getUnbindFunction(mId) | ||
}); }; | ||
}; | ||
Container.prototype._get = function (avoidConstraints, isMultiInject, targetType, serviceIdentifier, key, value) { | ||
@@ -211,0 +284,0 @@ var result = null; |
import { interfaces } from "../interfaces/interfaces"; | ||
declare class ContainerModule implements interfaces.ContainerModule { | ||
export declare class ContainerModule implements interfaces.ContainerModule { | ||
guid: string; | ||
@@ -7,2 +7,6 @@ registry: interfaces.ContainerModuleCallBack; | ||
} | ||
export { ContainerModule }; | ||
export declare class AsyncContainerModule implements interfaces.AsyncContainerModule { | ||
guid: string; | ||
registry: interfaces.AsyncContainerModuleCallBack; | ||
constructor(registry: interfaces.AsyncContainerModuleCallBack); | ||
} |
@@ -13,2 +13,3 @@ import { interfaces } from "../interfaces/interfaces"; | ||
load(...modules: interfaces.ContainerModule[]): void; | ||
loadAsync(...modules: interfaces.AsyncContainerModule[]): Promise<void>; | ||
unload(...modules: interfaces.ContainerModule[]): void; | ||
@@ -34,2 +35,3 @@ bind<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): interfaces.BindingToSyntax<T>; | ||
resolve<T>(constructorFunction: interfaces.Newable<T>): T; | ||
private _getContainerModuleHelpersFactory(); | ||
private _get<T>(avoidConstraints, isMultiInject, targetType, serviceIdentifier, key?, value?); | ||
@@ -36,0 +38,0 @@ private _planAndResolve<T>(); |
@@ -143,2 +143,3 @@ declare namespace interfaces { | ||
load(...modules: ContainerModule[]): void; | ||
loadAsync(...modules: AsyncContainerModule[]): Promise<void>; | ||
unload(...modules: ContainerModule[]): void; | ||
@@ -159,3 +160,8 @@ applyCustomMetadataReader(metadataReader: MetadataReader): void; | ||
} | ||
interface AsyncContainerModule { | ||
guid: string; | ||
registry: AsyncContainerModuleCallBack; | ||
} | ||
type ContainerModuleCallBack = (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => void; | ||
type AsyncContainerModuleCallBack = (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => Promise<void>; | ||
interface ContainerSnapshot { | ||
@@ -162,0 +168,0 @@ bindings: Lookup<Binding<any>>; |
@@ -10,1 +10,9 @@ import { guid } from "../utils/guid"; | ||
export { ContainerModule }; | ||
var AsyncContainerModule = (function () { | ||
function AsyncContainerModule(registry) { | ||
this.guid = guid(); | ||
this.registry = registry; | ||
} | ||
return AsyncContainerModule; | ||
}()); | ||
export { AsyncContainerModule }; |
@@ -0,1 +1,36 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
import { Binding } from "../bindings/binding"; | ||
@@ -66,3 +101,2 @@ import * as ERROR_MSGS from "../constants/error_msgs"; | ||
Container.prototype.load = function () { | ||
var _this = this; | ||
var modules = []; | ||
@@ -72,37 +106,36 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
var setModuleId = function (bindingToSyntax, moduleId) { | ||
bindingToSyntax._binding.moduleId = moduleId; | ||
}; | ||
var getBindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var bindingToSyntax = _this.bind.call(_this, serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
var getUnbindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _unbind = _this.unbind.bind(_this); | ||
_unbind(serviceIdentifier); | ||
}; | ||
}; | ||
var getIsboundFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _isBound = _this.isBound.bind(_this); | ||
return _isBound(serviceIdentifier); | ||
}; | ||
}; | ||
var getRebindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var bindingToSyntax = _this.rebind.call(_this, serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
modules.forEach(function (module) { | ||
var bindFunction = getBindFunction(module.guid); | ||
var unbindFunction = getUnbindFunction(module.guid); | ||
var isboundFunction = getIsboundFunction(module.guid); | ||
var rebindFunction = getRebindFunction(module.guid); | ||
module.registry(bindFunction, unbindFunction, isboundFunction, rebindFunction); | ||
var getHelpers = this._getContainerModuleHelpersFactory(); | ||
for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) { | ||
var currentModule = modules_1[_a]; | ||
var containerModuleHelpers = getHelpers(currentModule.guid); | ||
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction); | ||
} | ||
}; | ||
Container.prototype.loadAsync = function () { | ||
var modules = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
modules[_i] = arguments[_i]; | ||
} | ||
return __awaiter(this, void 0, void 0, function () { | ||
var getHelpers, _a, modules_2, currentModule, containerModuleHelpers; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
getHelpers = this._getContainerModuleHelpersFactory(); | ||
_a = 0, modules_2 = modules; | ||
_b.label = 1; | ||
case 1: | ||
if (!(_a < modules_2.length)) return [3, 4]; | ||
currentModule = modules_2[_a]; | ||
containerModuleHelpers = getHelpers(currentModule.guid); | ||
return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)]; | ||
case 2: | ||
_b.sent(); | ||
_b.label = 3; | ||
case 3: | ||
_a++; | ||
return [3, 1]; | ||
case 4: return [2]; | ||
} | ||
}); | ||
}); | ||
@@ -218,2 +251,42 @@ }; | ||
}; | ||
Container.prototype._getContainerModuleHelpersFactory = function () { | ||
var _this = this; | ||
var setModuleId = function (bindingToSyntax, moduleId) { | ||
bindingToSyntax._binding.moduleId = moduleId; | ||
}; | ||
var getBindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _bind = _this.bind.bind(_this); | ||
var bindingToSyntax = _bind(serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
var getUnbindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _unbind = _this.unbind.bind(_this); | ||
_unbind(serviceIdentifier); | ||
}; | ||
}; | ||
var getIsboundFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _isBound = _this.isBound.bind(_this); | ||
return _isBound(serviceIdentifier); | ||
}; | ||
}; | ||
var getRebindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _rebind = _this.rebind.bind(_this); | ||
var bindingToSyntax = _rebind(serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
return function (mId) { return ({ | ||
bindFunction: getBindFunction(mId), | ||
isboundFunction: getIsboundFunction(mId), | ||
rebindFunction: getRebindFunction(mId), | ||
unbindFunction: getUnbindFunction(mId) | ||
}); }; | ||
}; | ||
Container.prototype._get = function (avoidConstraints, isMultiInject, targetType, serviceIdentifier, key, value) { | ||
@@ -220,0 +293,0 @@ var result = null; |
@@ -12,1 +12,9 @@ "use strict"; | ||
exports.ContainerModule = ContainerModule; | ||
var AsyncContainerModule = (function () { | ||
function AsyncContainerModule(registry) { | ||
this.guid = guid_1.guid(); | ||
this.registry = registry; | ||
} | ||
return AsyncContainerModule; | ||
}()); | ||
exports.AsyncContainerModule = AsyncContainerModule; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -68,3 +103,2 @@ var binding_1 = require("../bindings/binding"); | ||
Container.prototype.load = function () { | ||
var _this = this; | ||
var modules = []; | ||
@@ -74,37 +108,36 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
var setModuleId = function (bindingToSyntax, moduleId) { | ||
bindingToSyntax._binding.moduleId = moduleId; | ||
}; | ||
var getBindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var bindingToSyntax = _this.bind.call(_this, serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
var getUnbindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _unbind = _this.unbind.bind(_this); | ||
_unbind(serviceIdentifier); | ||
}; | ||
}; | ||
var getIsboundFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _isBound = _this.isBound.bind(_this); | ||
return _isBound(serviceIdentifier); | ||
}; | ||
}; | ||
var getRebindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var bindingToSyntax = _this.rebind.call(_this, serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
modules.forEach(function (module) { | ||
var bindFunction = getBindFunction(module.guid); | ||
var unbindFunction = getUnbindFunction(module.guid); | ||
var isboundFunction = getIsboundFunction(module.guid); | ||
var rebindFunction = getRebindFunction(module.guid); | ||
module.registry(bindFunction, unbindFunction, isboundFunction, rebindFunction); | ||
var getHelpers = this._getContainerModuleHelpersFactory(); | ||
for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) { | ||
var currentModule = modules_1[_a]; | ||
var containerModuleHelpers = getHelpers(currentModule.guid); | ||
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction); | ||
} | ||
}; | ||
Container.prototype.loadAsync = function () { | ||
var modules = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
modules[_i] = arguments[_i]; | ||
} | ||
return __awaiter(this, void 0, void 0, function () { | ||
var getHelpers, _a, modules_2, currentModule, containerModuleHelpers; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
getHelpers = this._getContainerModuleHelpersFactory(); | ||
_a = 0, modules_2 = modules; | ||
_b.label = 1; | ||
case 1: | ||
if (!(_a < modules_2.length)) return [3, 4]; | ||
currentModule = modules_2[_a]; | ||
containerModuleHelpers = getHelpers(currentModule.guid); | ||
return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)]; | ||
case 2: | ||
_b.sent(); | ||
_b.label = 3; | ||
case 3: | ||
_a++; | ||
return [3, 1]; | ||
case 4: return [2]; | ||
} | ||
}); | ||
}); | ||
@@ -220,2 +253,42 @@ }; | ||
}; | ||
Container.prototype._getContainerModuleHelpersFactory = function () { | ||
var _this = this; | ||
var setModuleId = function (bindingToSyntax, moduleId) { | ||
bindingToSyntax._binding.moduleId = moduleId; | ||
}; | ||
var getBindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _bind = _this.bind.bind(_this); | ||
var bindingToSyntax = _bind(serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
var getUnbindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _unbind = _this.unbind.bind(_this); | ||
_unbind(serviceIdentifier); | ||
}; | ||
}; | ||
var getIsboundFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _isBound = _this.isBound.bind(_this); | ||
return _isBound(serviceIdentifier); | ||
}; | ||
}; | ||
var getRebindFunction = function (moduleId) { | ||
return function (serviceIdentifier) { | ||
var _rebind = _this.rebind.bind(_this); | ||
var bindingToSyntax = _rebind(serviceIdentifier); | ||
setModuleId(bindingToSyntax, moduleId); | ||
return bindingToSyntax; | ||
}; | ||
}; | ||
return function (mId) { return ({ | ||
bindFunction: getBindFunction(mId), | ||
isboundFunction: getIsboundFunction(mId), | ||
rebindFunction: getRebindFunction(mId), | ||
unbindFunction: getUnbindFunction(mId) | ||
}); }; | ||
}; | ||
Container.prototype._get = function (avoidConstraints, isMultiInject, targetType, serviceIdentifier, key, value) { | ||
@@ -222,0 +295,0 @@ var result = null; |
{ | ||
"name": "inversify", | ||
"version": "4.10.0", | ||
"version": "4.11.0", | ||
"description": "A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.", | ||
@@ -40,6 +40,6 @@ "main": "lib/inversify.js", | ||
"@types/harmony-proxy": "1.0.29", | ||
"@types/mocha": "2.2.47", | ||
"@types/mocha": "2.2.48", | ||
"@types/sinon": "4.1.3", | ||
"bluebird": "3.5.1", | ||
"browserify": "15.2.0", | ||
"browserify": "16.1.0", | ||
"chai": "4.1.2", | ||
@@ -53,4 +53,4 @@ "del": "3.0.0", | ||
"gulp-sourcemaps": "2.6.3", | ||
"gulp-tslint": "8.1.2", | ||
"gulp-typescript": "4.0.0-alpha.2", | ||
"gulp-tslint": "8.1.3", | ||
"gulp-typescript": "4.0.1", | ||
"gulp-uglify": "3.0.0", | ||
@@ -71,3 +71,3 @@ "harmonize": "2.0.0", | ||
"karma-sinon": "1.0.5", | ||
"mocha": "5.0.0", | ||
"mocha": "5.0.1", | ||
"performance-now": "2.1.0", | ||
@@ -77,4 +77,4 @@ "publish-please": "2.3.1", | ||
"run-sequence": "2.2.1", | ||
"sinon": "4.2.2", | ||
"tslint": "5.8.0", | ||
"sinon": "4.4.0", | ||
"tslint": "5.9.1", | ||
"typescript": "2.6.2", | ||
@@ -81,0 +81,0 @@ "vinyl-source-stream": "2.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
324947
6430