You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Si nous avons nos propres tâches asynchrones, différentes de `fetch`, nous pouvons utiliser un seul `AbortController` pour les arrêter, avec des fetches.
let results =awaitPromise.all([...fetchJobs, ourJob]);
158
139
159
-
<<<<<<<HEAD
160
140
// si controller.abort() est appelée d'ailleurs,
161
141
// elle interrompt tous les fetches et ourJob
162
-
=======
163
-
// if controller.abort() is called from anywhere,
164
-
// it aborts all fetches and ourJob
165
-
>>>>>>>468e3552884851fcef331fbdfd58096652964b5f
166
142
```
167
143
168
144
## Résumé
169
145
170
-
<<<<<<< HEAD
171
146
-`AbortController` est un objet simple qui génère un événement `abort` sur sa propriété `signal` lorsque la méthode `abort()` est appelée (et définit également `signal.aborted` sur` true`).
172
147
-`fetch` s'intègre avec lui : nous passons la propriété `signal` comme option, puis` fetch` l'écoute, il devient donc possible d'annuler le `fetch`.
173
-
- Nous pouvons utiliser `AbortController` dans notre code. L'"appel `abort()`" -> "écouter l'événement `abort`" l'interaction est simple et universelle. Nous pouvons l'utiliser même sans `fetch`.
174
-
=======
175
-
-`AbortController` is a simple object that generates an `abort` event on it's `signal` property when the `abort()` method is called (and also sets `signal.aborted` to `true`).
176
-
-`fetch` integrates with it: we pass the `signal` property as the option, and then `fetch` listens to it, so it's possible to abort the `fetch`.
177
-
- 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`.
178
-
>>>>>>> 468e3552884851fcef331fbdfd58096652964b5f
148
+
- Nous pouvons utiliser `AbortController` dans notre code. L'interaction "appeler `abort()`" -> "écouter l'événement `abort`" est simple et universelle. Nous pouvons l'utiliser même sans `fetch`.
0 commit comments