Skip to content

Instantly share code, notes, and snippets.

@captainill
Created May 14, 2015 22:38
Show Gist options
  • Save captainill/29948c3d4f4ef057bde9 to your computer and use it in GitHub Desktop.
Save captainill/29948c3d4f4ef057bde9 to your computer and use it in GitHub Desktop.
/**
*
*
*/
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