| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0269413 commit cf4fa79
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,11 +89,15 @@ ac.abort(); | |||
| 89 | 89 | ``` | |
| 90 | 90 | ||
| 91 | 91 | The `AbortController` with which the `AbortSignal` is associated will only | |
| 92 | - ever trigger the `'abort'` event once. Any event listeners attached to the | ||
| 93 | - `AbortSignal` *should* use the `{ once: true }` option (or, if using the | ||
| 94 | - `EventEmitter` APIs to attach a listener, use the `once()` method) to ensure | ||
| 95 | - that the event listener is removed as soon as the `'abort'` event is handled. | ||
| 96 | - Failure to do so may result in memory leaks. | ||
| 92 | + ever trigger the `'abort'` event once. We recommended that code check | ||
| 93 | + that the `abortSignal.aborted` attribute is `false` before adding an `'abort'` | ||
| 94 | + event listener. | ||
| 95 | + | ||
| 96 | + Any event listeners attached to the `AbortSignal` should use the | ||
| 97 | + `{ once: true }` option (or, if using the `EventEmitter` APIs to attach a | ||
| 98 | + listener, use the `once()` method) to ensure that the event listener is | ||
| 99 | + removed as soon as the `'abort'` event is handled. Failure to do so may | ||
| 100 | + result in memory leaks. | ||
| 97 | 101 | ||
| 98 | 102 | #### `abortSignal.aborted` | |
| 99 | 103 | <!-- YAML | |
| Back | FazBrowse Home | New Git URL |
0 commit comments