Skip to content

Instantly share code, notes, and snippets.

@griffinmichl
Created May 15, 2016 01:17
Show Gist options
  • Save griffinmichl/c61f2555339aba9ee2e8483c652b604e to your computer and use it in GitHub Desktop.
Save griffinmichl/c61f2555339aba9ee2e8483c652b604e to your computer and use it in GitHub Desktop.
const fetchContent = (url) => {
const timeDelay$ = Rx.Observable.timer(1000);
const request$ = Rx.Observable.create(observer =>
fetch(url, { mode: 'no-cors' })
.then(json => {
console.log('test')
observer.onNext(json)
observer.onCompleted()
})
.catch(e => observer.onError())
)
return timeDelay$.concat(request$);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment