0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-14 02:02:51 +00:00
This commit is contained in:
Scott Tolksdorf
2016-12-27 17:42:16 -05:00
parent f75f60aa1e
commit 41303e6918
7 changed files with 22 additions and 126 deletions

View File

@@ -23,16 +23,16 @@ const ContinousSave = React.createClass({
};
},
componentDidMount: function() {
flux.actionEmitter.on('dispatch', this.brewUpdate);
flux.actionEmitter.on('dispatch', this.actionHandler);
window.onbeforeunload = ()=>{
if(this.props.status !== 'ready') return 'You have unsaved changes!';
};
},
componentWillUnmount: function() {
flux.actionEmitter.removeListenr('dispatch', this.brewUpdate);
flux.actionEmitter.removeListener('dispatch', this.actionHandler);
window.onbeforeunload = function(){};
},
brewUpdate : function(actionType){
actionHandler : function(actionType){
if(actionType == 'UPDATE_BREW_TEXT' || actionType == 'UPDATE_META'){
Actions.pendingSave();
}