BACK
Referencetimeout
Reference · 112

timeout

Throws an error or switches if a value doesn't arrive in time.

Signature

timeout(config: number | Date | TimeoutConfig): MonoTypeOperatorFunction

What it does

Watches the time to the first or next value. If the limit is exceeded, it throws a TimeoutError or uses the fallback from the config.

When to use

Guarding HTTP/WebSocket, waiting for a device response, fail-fast for long operations.

See also

catchError, timer, raceWith

script.ts // TypeScript
CONSOLE · Console output
Hit Run to see the result...