Skip to content

Instantly share code, notes, and snippets.

@armanozak
Created May 3, 2021 09:14
Show Gist options
  • Save armanozak/a1b06e66a6943be7f62be040f11af80d to your computer and use it in GitHub Desktop.
Save armanozak/a1b06e66a6943be7f62be040f11af80d to your computer and use it in GitHub Desktop.
[What's New in RxJS 7] RxJS 7 timeout #blog #rxjs
import { timer } from "rxjs";
import { timeout } from "rxjs/operators";
const count$ = timer(3000, 2000);
count$
.pipe(timeout({ first: 5000, each: 1000 }))
.subscribe({ next: console.log, error: console.error });
// (after ~3s) 0
// (after ~1s) Error: Timeout has occurred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment