reactive-di
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -44,3 +44,3 @@ 'use strict'; | ||
var result = di.getProvider(B).dependants.map(depName); | ||
var result = di.getProvider(B).dependants.items.map(depName); | ||
// console.log(result, di.getProvider(B).displayName) | ||
@@ -73,3 +73,3 @@ _powerAssert2.default.deepEqual(_rec._expr(_rec._capt(result, 'arguments/0'), { | ||
var result = di.getProvider(B).dependants.map(depName); | ||
var result = di.getProvider(B).dependants.items.map(depName); | ||
@@ -102,3 +102,3 @@ _powerAssert2.default.deepEqual(_rec3._expr(_rec3._capt(result, 'arguments/0'), { | ||
var result = di.getProvider(B).dependants.map(depName); | ||
var result = di.getProvider(B).dependants.items.map(depName); | ||
@@ -105,0 +105,0 @@ _powerAssert2.default.deepEqual(_rec5._expr(_rec5._capt(result, 'arguments/0'), { |
@@ -5,2 +5,8 @@ 'use strict'; | ||
var _DisposableCollection = require('../utils/DisposableCollection'); | ||
var _DisposableCollection2 = _interopRequireDefault(_DisposableCollection); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -12,3 +18,4 @@ | ||
Container, | ||
Provider | ||
Provider, | ||
Collection | ||
} from 'reactive-di/i/coreInterfaces'*/ | ||
@@ -23,3 +30,3 @@ | ||
this.dependencies = [this]; | ||
this.dependants = [this]; | ||
this.dependants = new _DisposableCollection2.default([this]); | ||
this.isCached = false; | ||
@@ -47,3 +54,3 @@ this.isDisposed = false; | ||
BaseProvider.prototype.addDependant = function addDependant(dependant /*: P*/) { | ||
this.dependants.push(dependant); | ||
this.dependants.add(dependant); | ||
}; | ||
@@ -50,0 +57,0 @@ |
@@ -65,5 +65,8 @@ 'use strict'; | ||
if (depMiddlewares) { | ||
var m = mdls.length; | ||
for (var j = 0, k = depMiddlewares.length; j < k; j++) { | ||
mdls[mdls.length++] = this.getProvider(depMiddlewares[j]); | ||
mdls[m] = this.getProvider(depMiddlewares[j]); | ||
m = m + 1; | ||
} | ||
mdls.length = m; | ||
} | ||
@@ -76,3 +79,3 @@ } | ||
DefaultContainer.prototype._getDeps = function _getDeps(deps /*: Array<DepItem>*/) { | ||
var depNames /*: ?Array<string>*/ = void 0; | ||
var depNames /*: ?Array<string>*/ = null; | ||
var resolvedDeps /*: Array<Provider>*/ = new Array(deps.length); | ||
@@ -92,3 +95,2 @@ var l /*: number*/ = deps.length; | ||
} else { | ||
depNames = null; | ||
for (var _i = 0; _i < l; _i++) { | ||
@@ -95,0 +97,0 @@ var dep /*: Provider*/ = this.getProvider(((deps /*: any*/) /*: Array<DependencyKey>*/)[_i]); |
@@ -51,3 +51,3 @@ 'use strict'; | ||
var deps /*: Array<Provider>*/ = dependency.dependants; | ||
var deps /*: Array<Provider>*/ = dependency.dependants.items; | ||
var k /*: number*/ = deps.length; | ||
@@ -54,0 +54,0 @@ var l = this.length; |
@@ -19,3 +19,4 @@ 'use strict'; | ||
/*:: import type { | ||
Provider | ||
Provider, | ||
Collection | ||
} from 'reactive-di/i/coreInterfaces'*/ | ||
@@ -22,0 +23,0 @@ |
@@ -12,2 +12,11 @@ /* @flow */ | ||
export type Disposable = { | ||
isDisposed: boolean; | ||
} | ||
export type Collection<T: Disposable> = { | ||
items: Array<T>; | ||
add(item: T): void; | ||
} | ||
export type Annotation = { | ||
@@ -24,3 +33,3 @@ kind: any; | ||
export type Provider<Ann: Annotation> = { | ||
export type Provider<Ann: Annotation> = Disposable & { | ||
kind: any; | ||
@@ -39,3 +48,3 @@ displayName: string; | ||
*/ | ||
dependants: Array<Provider>; | ||
dependants: Collection<Provider>; | ||
@@ -42,0 +51,0 @@ /** |
{ | ||
"name": "reactive-di", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Reactive dependency injection", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
214331
92
2275