Created
September 6, 2017 03:17
-
-
Save Calvin-Huang/dbfa4b979b422d541a669314eef26ada 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
// Throttling | |
const inputEpic = (action$) => | |
action$.ofType('INPUT_CHANGED') | |
.throttleTime(500) | |
... | |
// Deboucing | |
const inputEpic = (action$) => | |
action$.ofType('INPUT_CHANGED') | |
.debounceTime(500) | |
... | |
// Retry 5 times without waiting | |
const inputEpic = (action$) => | |
action$.ofType('INPUT_CHANGED') | |
.retry(5) | |
... | |
// Retry 5 times with waiting for 2 seconds | |
const inputEpic = (action$) => | |
action$.ofType('INPUT_CHANGED') | |
.retryWhen(function(errors) { | |
return errors | |
.delay(2000) | |
.scan((errorCount, err) => { | |
if(errorCount >= 2) { | |
throw err; | |
} | |
return errorCount + 1; | |
}, 0); | |
}) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment