Created
June 24, 2016 20:29
-
-
Save yongjhih/4c850cdf59d88c1c2dde7c7f66f91dac 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
| function rxfetch(url) { | |
| return rxfetch(url).flatMap(function (response) { | |
| var next = response.headers.get('Link').replace(/<([^<]*)>; rel="next".*/, '$1'); | |
| return Rx.Observable.concat(Rx.Observable.just(response), next ? rxfetch3(next) : Rx.Observable.empty()); | |
| }); | |
| } | |
| rxfetch('https://api.github.com/users/yongjhih/repos') | |
| .map(function (response) { return response.json(); }) | |
| .flatMap(function (json) { return Rx.Observable.from(json); }) | |
| .map(function (json) { return json.name; }) | |
| .subscribe(function (name) { | |
| console.log(name); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment