Skip to content

Instantly share code, notes, and snippets.

@kosich
Last active March 17, 2019 17:33
Show Gist options
  • Save kosich/c526cd7d75713adbf86b60db5860e333 to your computer and use it in GitHub Desktop.
Save kosich/c526cd7d75713adbf86b60db5860e333 to your computer and use it in GitHub Desktop.
const { rxObserver, palette } = require('api/v0.3');
const { of, timer } = require('rxjs');
const { retry, switchMap, timeout } = require('rxjs/operators');
let index = 0;
const source$ = of(void 0).pipe(
switchMap(()=>
// 4 attempts
timer([20, 20, 20, 5][index++])
)
);
const retry$ = source$.pipe(
timeout(10),
retry(3)
);
retry$.subscribe(rxObserver());
@kosich
Copy link
Author

kosich commented Mar 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment