Created
August 14, 2018 03:56
-
-
Save uutarou10/d8269b74e800dffdf2ead22c307309d8 to your computer and use it in GitHub Desktop.
RxJSの練習、キモすぎる。
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
const axios = require('axios'); | |
const Rx = require('rxjs'); | |
const { mergeMap, mapTo } = require('rxjs/operators'); | |
const getArticles = () => ( | |
axios.get('https://qiita.com/api/v2/users/uutarou10/items') | |
.then(res => { | |
return res.data | |
}) | |
); | |
console.log('start'); | |
Rx.timer(1000) | |
.pipe( | |
mergeMap(() => getArticles()), | |
mergeMap(articles => { | |
return articles.map(a => a); | |
}) | |
) | |
.subscribe(val => console.log(val.title)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment