Merge pull request #2142 from joaquinelio/patch-1

One more step please
This commit is contained in:
Ilya Kantor 2020-09-22 21:27:54 +03:00 committed by GitHub
commit 75680eef5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,7 @@ The usage is very straightforward:
## The AbortController object ## The AbortController object
Step 1: create a controller: Create a controller:
```js ```js
let controller = new AbortController(); let controller = new AbortController();
@ -145,4 +145,4 @@ let results = await Promise.all([...fetchJobs, ourJob]);
- `AbortController` is a simple object that generates `abort` event on it's `signal` property when `abort()` method is called (and also sets `signal.aborted` to `true`). - `AbortController` is a simple object that generates `abort` event on it's `signal` property when `abort()` method is called (and also sets `signal.aborted` to `true`).
- `fetch` integrates with it: we pass `signal` property as the option, and then `fetch` listens to it, so it becomes possible to abort the `fetch`. - `fetch` integrates with it: we pass `signal` property as the option, and then `fetch` listens to it, so it becomes possible to abort the `fetch`.
- We can use `AbortController` in our code. The "call `abort()`" -> "listen to `abort` event" interaction is simple and universal. We can use it even without `fetch`. - We can use `AbortController` in our code. The "call `abort()`" -> "listen to `abort` event" interaction is simple and universal. We can use it even without `fetch`.