JSFiddle - React, Tailwind, and code Playground
by Andrea Forni
HTML
<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.umd.js"></script>
JavaScript
let result = Rx.Observable.fromPromise(fetch('/echo/html/'));
const maxRetries = 3;
result
.retryWhen(attempts => range(1, maxRetries).tap(v => console.log('Attempt:', v)))
.subscribe(
x => console.log('Response:', x),
e => console.error('Error:',e)
);