Created
May 14, 2015 22:38
-
-
Save captainill/29948c3d4f4ef057bde9 to your computer and use it in GitHub Desktop.
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
/** | |
* | |
* | |
*/ | |
import BaseStore from 'fluxible/addons/BaseStore'; | |
class RecipeStore extends BaseStore{ | |
static handlers = { | |
'LOAD_PAGE': 'handleContentChange' | |
} | |
constructor (dispatcher) { | |
super(dispatcher); | |
this.dispatcher = dispatcher; // Provides access to waitFor and getStore methods | |
} | |
initialize () { | |
this.content = 'initial content...'; | |
} | |
handleContentChange(payload) { | |
this.content = 'content for page with id '+payload.id; | |
this.emitChange(); | |
} | |
getState() { | |
return { | |
content: this.content | |
}; | |
} | |
dehydrate() { | |
return this.getState(); | |
} | |
rehydrate(state) { | |
this.content = state.content; | |
} | |
} | |
RecipeStore.storeName = 'RecipeStore'; | |
export default RecipeStore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment