Skip to content

Instantly share code, notes, and snippets.

@zinevych
Last active October 14, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zinevych/4e658fc8e2a6ba5f0eb6 to your computer and use it in GitHub Desktop.
Save zinevych/4e658fc8e2a6ba5f0eb6 to your computer and use it in GitHub Desktop.
var EventEmitter = require('events').EventEmitter;
var Dispatcher = require('Dispatcher');
var DemoStore = assign({}, EventEmitter.prototype, {
demoMethod: function() {
//some functionality
},
emitChange: function() {
this.emit('change');
},
addChangeListener: function(callback) {
this.on('change', callback);
},
removeChangeListener: function(callback) {
this.removeListener('change', callback);
}
});
Dispatcher.register(function(action) {
switch(action.actionType) {
case 'calculateSmth':
DemoStore.demoMethod()
break;
default:
//no option
}
});
module.exports = DemoStore;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment