Example 1 — Quick demo
Core usage.
JavaScript
const c = new AbortController();
console.log(c.signal.aborted);
c.abort();
console.log(c.signal.aborted);How It Works
- controller. Owns a signal.
- abort(). Marks signal.aborted true.
AbortController lets you cancel fetch (and other abortable APIs) via an AbortSignal.
| Topic | Summary |
|---|---|
basics | abort a signal and wire it to fetch options. |
const c = new AbortController();
console.log(c.signal.aborted);
c.abort();
console.log(c.signal.aborted);Core usage.
const c = new AbortController();
console.log(c.signal.aborted);
c.abort();
console.log(c.signal.aborted);CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful