Skip to content

Instantly share code, notes, and snippets.

@georgymh
Created January 19, 2016 02:19
Show Gist options
  • Save georgymh/098fb7e6002d3159bd96 to your computer and use it in GitHub Desktop.
Save georgymh/098fb7e6002d3159bd96 to your computer and use it in GitHub Desktop.
Flux Basic Store File
"use strict";
var Dispatcher = require('../dispatcher/appDispatcher');
var ActionTypes = require('../constants/actionTypes');
var EventEmitter = require('events').EventEmitter;
var assign = require('object-assign');
var CHANGE_EVENT = 'change';
var Store = assign({}, EventEmitter.prototype, {
addChangeListener: function(callback) {
this.on(CHANGE_EVENT, callback);
},
removeChangeListener: function(callback) {
this.removeListener(CHANGE_EVENT, callback);
},
emitChange: function() {
this.emit(CHANGE_EVENT);
}
});
Dispatcher.register(function(action) {
switch(action.actionType) {
}
});
module.exports = Store;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment