Last active
March 26, 2017 19:45
-
-
Save qwtel/8bdd82eedec95f175c212031a20d7b53 to your computer and use it in GitHub Desktop.
Make an observable take at least a certain time
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
| const MIN_DURATION = 100; | |
| ajaxRequest(href) | |
| .zip(Observable.timer(MIN_DURATION), x => x)) | |
| .subscribe(response => { | |
| // will execute after at least 100ms or longer depending on how long the request takes | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turn into an operator:
Usage:
Alternatively via monkey patching