Last active
July 13, 2016 16:09
-
-
Save colinf/aa4ed68670149bc2e90d to your computer and use it in GitHub Desktop.
Base Flux Store class in ES6 ( See http://bit.ly/29RY6gq )
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
import EventEmitter from 'events'; | |
var CHANGE_EVENT = 'change'; | |
class Store extends EventEmitter { | |
constructor() { | |
super(); | |
} | |
emitChange() { | |
this.emit(CHANGE_EVENT); | |
} | |
addChangeListener(callback) { | |
this.on(CHANGE_EVENT, callback); | |
} | |
removeChangeListener(callback) { | |
this.removeListener(CHANGE_EVENT, callback); | |
} | |
} | |
Store.dispatchToken = null; | |
export default Store; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what about this? see any problems?
https://gist.github.com/andrewmclagan/33f3491758e24a30f911