Content
View differences
Updated by Kabiru Mwenja 11 months ago
[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) is a browser API that lets you manage the lifecycle of event listeners and other asynchronous operations. You create an AbortController, pass its signal to addEventListener, and later call abort() to remove all listeners attached with that signal.
Example:
```js
const controller = new AbortController();
window.addEventListener('beforeunload', handler, { signal: controller.signal });
// Later, to remove the listener:
controller.abort(); // All listeners attached with this signal are removed
```
Follows improvements seen in https://github.com/opf/openproject/pull/19442 😇
Example:
```js
const controller = new AbortController();
window.addEventListener('beforeunload', handler, { signal: controller.signal });
// Later, to remove the listener:
controller.abort(); // All listeners attached with this signal are removed
```
Follows improvements seen in https://github.com/opf/openproject/pull/19442 😇