Last active
November 19, 2016 02:30
-
-
Save miwillhite/6d12fefa992f3c2913004b9acefaf35c to your computer and use it in GitHub Desktop.
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
var store = new TaskStore(reducer, actions.init({ | |
tasks: { | |
incomplete: incompleteTasks, | |
complete: completedTasks, | |
}, | |
})); | |
store.state.observe(function (state) { console.log(state) }); |
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
(function () { | |
'use strict'; | |
var empty = R.empty; | |
function TaskStore () { | |
var dispatcher = mostSubject.subject(); | |
return function constructor (reducer, initialState) { | |
this.state = dispatcher | |
.scan(reducer, head(initialState)) | |
.thru(mostHold.default); | |
this.dispatch = dispatcher.next.bind(dispatcher); | |
return this; | |
}; | |
} | |
angular | |
.module('task') | |
.factory('TaskStore', TaskStore); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment