Forked from allenevans/rxjs.array-over-time-iteration.js
Created
October 13, 2020 22:47
-
-
Save AliSawari/2a2573ad443de0220b32a9ce2e6dba0e to your computer and use it in GitHub Desktop.
RxJS iterate over an array by 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 keyInputs = [ | |
['n', 1], | |
['e', 10], | |
['w', 100], | |
[' ', 1], | |
['y', 10], | |
['o', 100], | |
['r', 300], | |
['k', 200] | |
]; | |
Rx.Observable.from(keyInputs) | |
.concatMap(([key, delayFor]) => Rx.Observable.of(key).delay(delayFor)) | |
.subscribe(d => console.log(d)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment