Last active
October 14, 2015 21:28
-
-
Save zinevych/4e658fc8e2a6ba5f0eb6 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
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