Suggest an editImprove this articleRefine the answer for “What does timer() do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)`timer()` in RxJS creates a stream (`Observable`) that **emits a value after a delay**, and can also repeat at an interval if needed. **Key point:** it is a reactive "delay" with precise control over pauses.Shown above the full answer for quick recall.Answer (EN)Image`timer()` in RxJS creates a stream (`Observable`) that **emits a value after a delay**, and if needed, it can also **repeat** at an interval. --- ### Simple version: ```ts import { timer } from 'rxjs'; timer(2000).subscribe(() => console.log('2 seconds have passed')); ``` Outputs the message **once, after 2 seconds**. --- ### Repeating version: ```ts timer(1000, 2000).subscribe(x => console.log(x)); ``` - After 1 second it outputs `0`, - then every 2 seconds: `1`, `2`, `3`... This is like `interval()`, but with an **initial delay**. --- ### Comparison: | What it does | What it looks like | |---|---| | One-time run after 3 sec | `timer(3000)` | | Starts after 1 sec, then every 2 | `timer(1000, 2000)` | --- ### Where it's used: - Show a message after a delay - Start a countdown after a pause - Simulate loading - Combine with `switchMap` to start a timer after a click --- ### Conclusion: `timer()` is a **reactive "delay"**. You can run something after a time or regularly, with precise control over pauses.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.