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