AsyncDisposableStack() constructor
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The AsyncDisposableStack() constructor creates AsyncDisposableStack objects.
Syntax
js
new AsyncDisposableStack()
Parameters
None.
Return value
A new AsyncDisposableStack object.
Examples
>Creating an AsyncDisposableStack
js
const disposer = new AsyncDisposableStack();
disposer.defer(() => console.log("Disposed!"));
await disposer.disposeAsync();
// Logs: Disposed!
Specifications
| Specification |
|---|
| ECMAScript Async Explicit Resource Management> # sec-properties-of-the-asyncdisposablestack-constructor> |
Browser compatibility
Loading…