Created
January 19, 2016 02:19
-
-
Save georgymh/098fb7e6002d3159bd96 to your computer and use it in GitHub Desktop.
Flux Basic Store File
This file contains hidden or 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
"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