Use Case: Cancellation
Abort stale requests in UIs and worker pipelines to save resources.
AbortController Flow
ts
1import { createCrossConnection } from "cross-connection";23const client = createCrossConnection();4const controller = new AbortController();56const promise = client.get("https://jsonplaceholder.typicode.com/todos/1", {7 signal: controller.signal,8});910controller.abort();11await promise;
- Works with native AbortController and AbortSignal.
- Prevents outdated responses from racing into the UI.
- Plays nicely with timeout and retry strategies.