diff options
Diffstat (limited to 'app/scripts/lib/observable/util/sync.js')
-rw-r--r-- | app/scripts/lib/observable/util/sync.js | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/app/scripts/lib/observable/util/sync.js b/app/scripts/lib/observable/util/sync.js deleted file mode 100644 index c61feb02..00000000 --- a/app/scripts/lib/observable/util/sync.js +++ /dev/null @@ -1,24 +0,0 @@ - -// -// synchronizeStore(inStore, outStore, stateTransform) -// -// keeps outStore synchronized with inStore, via an optional stateTransform -// - -module.exports = synchronizeStore - - -function synchronizeStore(inStore, outStore, stateTransform) { - stateTransform = stateTransform || transformNoop - const initState = stateTransform(inStore.get()) - outStore.put(initState) - inStore.subscribe((inState) => { - const outState = stateTransform(inState) - outStore.put(outState) - }) - return outStore -} - -function transformNoop(state) { - return state -}
\ No newline at end of file |