Skip to content

Instantly share code, notes, and snippets.

@ssougnez
Last active March 14, 2021 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssougnez/bc8ea2bb2ae04fe791fff791486e21f1 to your computer and use it in GitHub Desktop.
Save ssougnez/bc8ea2bb2ae04fe791fff791486e21f1 to your computer and use it in GitHub Desktop.
import { Observable } from 'rxjs';
import { retryWhen, take } from 'rxjs/operators';
observable
.pipe(
retryWhen(errors => errors.pipe(take(2)))
)
.subscribe({
next: x => console.log(`${x} received`),
complete: () => console.log('Completed'),
error: err => console.warn(err)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment