ctx-connect
Advanced tools
Comparing version 2.0.4 to 2.1.0
@@ -10,6 +10,11 @@ (function (root, factory) { | ||
}(this, function (React, R, Reflux) { | ||
return function (storeName, stateKeyName) { | ||
return function (storeName, stateKeyName, getter) { | ||
if (!stateKeyName) { | ||
stateKeyName = storeName; | ||
} | ||
if (!getter) { | ||
getter = function (store) { | ||
return store.getInitialState(); | ||
}; | ||
} | ||
return R.merge(Reflux.ListenerMethods, { | ||
@@ -21,3 +26,4 @@ contextTypes: { | ||
var state = {}; | ||
state[stateKeyName] = this.context.stores[storeName].getInitialState(); | ||
state[stateKeyName] = getter.call(this, | ||
this.context.stores[storeName]); | ||
return state; | ||
@@ -29,3 +35,4 @@ }, | ||
var state = {}; | ||
state[stateKeyName] = v; | ||
state[stateKeyName] = getter.call(this, | ||
this.context.stores[storeName]); | ||
this.setState(state); | ||
@@ -32,0 +39,0 @@ }.bind(this)); |
{ | ||
"name": "ctx-connect", | ||
"version": "2.0.4", | ||
"version": "2.1.0", | ||
"description": "Mixin for React to connect Reflux store from context", | ||
@@ -5,0 +5,0 @@ "main": "ctx-connect.js", |
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
2215
41