-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove wrapper function around StoreWatchMixin
- Loading branch information
Brandon Tilley
committed
May 18, 2014
1 parent
f6b9298
commit 7015951
Showing
1 changed file
with
21 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,26 @@ | ||
module.exports = function(React) { | ||
return function() { | ||
var storeNames = Array.prototype.slice.call(arguments); | ||
return { | ||
componentWillMount: function() { | ||
var flux = this.props.flux || this.context.flux; | ||
_.each(storeNames, function(store) { | ||
flux.store(store).on("change", this._setStateFromFlux) | ||
}, this); | ||
}, | ||
module.exports = function() { | ||
var storeNames = Array.prototype.slice.call(arguments); | ||
return { | ||
componentWillMount: function() { | ||
var flux = this.props.flux || this.context.flux; | ||
_.each(storeNames, function(store) { | ||
flux.store(store).on("change", this._setStateFromFlux) | ||
}, this); | ||
}, | ||
|
||
componentWillUnmount: function() { | ||
var flux = this.props.flux || this.context.flux; | ||
_.each(storeNames, function(store) { | ||
flux.store(store).off("change", this._setStateFromFlux) | ||
}, this); | ||
}, | ||
componentWillUnmount: function() { | ||
var flux = this.props.flux || this.context.flux; | ||
_.each(storeNames, function(store) { | ||
flux.store(store).off("change", this._setStateFromFlux) | ||
}, this); | ||
}, | ||
|
||
_setStateFromFlux: function() { | ||
this.setState(this.getStateFromFlux()); | ||
}, | ||
_setStateFromFlux: function() { | ||
this.setState(this.getStateFromFlux()); | ||
}, | ||
|
||
getInitialState: function() { | ||
return this.getStateFromFlux(); | ||
} | ||
getInitialState: function() { | ||
return this.getStateFromFlux(); | ||
} | ||
}; | ||
} | ||
}; |