Skip to content

Instantly share code, notes, and snippets.

@kahlil
Last active February 7, 2016 22:06
Show Gist options
  • Save kahlil/c705a3606cc9db189d09 to your computer and use it in GitHub Desktop.
Save kahlil/c705a3606cc9db189d09 to your computer and use it in GitHub Desktop.
import ACTION_CONSTANTS from '../../constant/action-constants';
import Rx from 'rx';
class SomeStore {
constructor(dispatcher) {
'ngInject';
this.dispatcher = dispatcher;
this.someStore$ = this.registerActionHandlers();
}
registerActionHandlers() {
return this.dispatcher
.filter((action) => action === ACTION_CONSTANTS.SOME_ACTION)
.scan((someState, action) => !someState, false);
}
}
export default SomeStore;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment