and for model destory TODO polyfill TODO mixin

This commit is contained in:
Peter Cottle 2015-04-11 12:13:19 -07:00
parent d4e0887bc7
commit 1427ba0e58
3 changed files with 54 additions and 1 deletions

View file

@ -18,11 +18,17 @@ var CommandView = React.createClass({
componentDidMount: function() {
this.props.command.on('change', this.updateStateFromModel, this);
this.props.command.on('destroy', this.onModelDestroy, this);
this.updateStateFromModel();
},
componentWillUnmount: function() {
this.props.command.off('change', this.updateStateFromModel, this);
this.props.command.off('destroy', this.onModelDestroy, this);
},
onModelDestroy: function() {
React.unmountComponentAtNode(this.getDOMNode().parentNode);
},
updateStateFromModel: function() {