Created
November 22, 2016 01:58
-
-
Save rt2zz/950c4323a1e8b8eb9368aae973a325fa 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
// time iterator (read: debounce) | |
if (timeIterator === null) { | |
timeIterator = setInterval(processNextReducer, debounce) | |
} | |
function flush () { | |
storesToProcess.forEeach(processNextReducer) | |
} | |
function processNextReducer () { | |
if (storesToProcess.length === 0) { | |
clearInterval(timeIterator) | |
timeIterator = null | |
return | |
} | |
let key = storesToProcess[0] | |
let storageKey = createStorageKey(key) | |
let endState = transforms.reduce((subState, transformer) => transformer.in(subState, key), stateGetter(store.getState(), key)) | |
if (typeof endState !== 'undefined') storage.setItem(storageKey, serializer(endState), warnIfSetError(key)) | |
storesToProcess.shift() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment