reactive-di
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -64,3 +64,3 @@ 'use strict'; | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)(2)], [myFn, (0, _configurations.factory)(MyValue)]]).createContainer(); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)({ value: 2 })], [myFn, (0, _configurations.factory)(MyValue)]]).createContainer(); | ||
@@ -94,3 +94,3 @@ var result = newDi.get(myFn); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)({ a: 1, b: 2 })], [myFn, (0, _configurations.factory)(MyValue)]]).createContainer(); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)({ value: { a: 1, b: 2 } })], [myFn, (0, _configurations.factory)(MyValue)]]).createContainer(); | ||
@@ -122,3 +122,3 @@ var result = newDi.get(myFn); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)('123')], [MyClass, (0, _configurations.klass)(MyValue)]]).createContainer(); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)({ value: '123' })], [MyClass, (0, _configurations.klass)(MyValue)]]).createContainer(); | ||
var result = newDi.get(MyClass); | ||
@@ -149,3 +149,3 @@ (0, _powerAssert2.default)(_rec7._expr(_rec7._capt(_rec7._capt(result, 'arguments/0/left') instanceof _rec7._capt(MyClass, 'arguments/0/right'), 'arguments/0'), { | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)(2)], [myFn, (0, _configurations.compose)(MyValue)]]).createContainer(); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)({ value: 2 })], [myFn, (0, _configurations.compose)(MyValue)]]).createContainer(); | ||
@@ -152,0 +152,0 @@ var result = newDi.get(myFn); |
@@ -44,3 +44,3 @@ 'use strict'; | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)(2)], [myFn, (0, _configurations.compose)(MyValue)], [myFnMiddleware, (0, _configurations.compose)()]], [[myFnMiddleware, [myFn]]]).createContainer(); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)({ value: 2 })], [myFn, (0, _configurations.compose)(MyValue)], [myFnMiddleware, (0, _configurations.compose)()]], [[myFnMiddleware, [myFn]]]).createContainer(); | ||
@@ -126,3 +126,3 @@ var result = newDi.get(myFn); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)(2)], [myFn, (0, _configurations.tag)((0, _configurations.compose)(MyValue), 'mytag')], [myFnMiddleware, (0, _configurations.compose)()]], [[myFnMiddleware, ['mytag']]]).createContainer(); | ||
var newDi /*: Container*/ = (0, _createContainer.createContainer)([[MyValue, (0, _configurations.value)({ value: 2 })], [myFn, (0, _configurations.tag)((0, _configurations.compose)(MyValue), 'mytag')], [myFnMiddleware, (0, _configurations.compose)()]], [[myFnMiddleware, ['mytag']]]).createContainer(); | ||
@@ -129,0 +129,0 @@ var result = newDi.get(myFn); |
@@ -96,4 +96,2 @@ 'use strict'; | ||
var annotation /*: Annotation*/ = _extends({}, (raw /*: any*/), { | ||
level: raw.level || 0, | ||
strategy: raw.strategy || 'down', | ||
kind: raw.kind, | ||
@@ -100,0 +98,0 @@ displayName: raw.kind + '@' + dn, |
@@ -187,3 +187,3 @@ 'use strict'; | ||
provider = plugin.createProvider(annotation, this); | ||
provider = plugin.createProvider(annotation, this, key); | ||
@@ -190,0 +190,0 @@ if (l !== updater.length) { |
@@ -13,14 +13,26 @@ 'use strict'; | ||
} from 'reactive-di'*/ | ||
function value(val /*: any*/) /*: RawAnnotation*/ { | ||
function value() /*: RawAnnotation*/ { | ||
var rec /*: { | ||
value?: mixed, | ||
key?: string | ||
}*/ = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
return { | ||
kind: 'value', | ||
value: val | ||
key: rec.key, | ||
value: rec.value | ||
}; | ||
} | ||
function valueAnn(val /*: any*/) /*: (target: Dependency) => Dependency*/ { | ||
function valueAnn() /*: (target: Dependency) => Dependency*/ { | ||
var rec /*: { | ||
value?: mixed, | ||
key?: string | ||
}*/ = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
return function _value(target /*: Dependency*/) /*: Dependency*/ { | ||
_annotationDriver.rdi.set(target, { | ||
kind: 'value', | ||
value: val | ||
value: rec.value, | ||
key: rec.key | ||
}); | ||
@@ -27,0 +39,0 @@ return target; |
@@ -27,3 +27,3 @@ 'use strict'; | ||
function ValueProvider /*:: <V>*/(annotation /*: ValueAnnotation<V>*/, container /*: Container*/, value /*: ?V*/) { | ||
function ValueProvider(annotation /*: ValueAnnotation*/, container /*: Container*/, key /*: DependencyKey*/) { | ||
_classCallCheck(this, ValueProvider); | ||
@@ -35,3 +35,3 @@ | ||
_this.value = value || annotation.value; | ||
_this.value = container.initState.get(annotation.key || key) || annotation.value; | ||
return _this; | ||
@@ -50,4 +50,4 @@ } | ||
ValuePlugin.prototype.createProvider = function createProvider(annotation /*: ValueAnnotation*/, container /*: Container*/, value /*: any*/) { | ||
return new ValueProvider(annotation, container, value); | ||
ValuePlugin.prototype.createProvider = function createProvider(annotation /*: ValueAnnotation*/, container /*: Container*/, key /*: DependencyKey*/) { | ||
return new ValueProvider(annotation, container, key); | ||
}; | ||
@@ -54,0 +54,0 @@ |
@@ -165,3 +165,3 @@ /* @flow */ | ||
container: Container, | ||
initialState: ?State | ||
key: DependencyKey | ||
): P; | ||
@@ -168,0 +168,0 @@ } |
{ | ||
"name": "reactive-di", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"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
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
239264
2595