AsyncDisposableStack() constructor
The AsyncDisposableStack() constructor creates AsyncDisposableStack objects.
The AsyncDisposableStack() constructor creates AsyncDisposableStack objects.
Syntax
new AsyncDisposableStack()
[!NOTE]
AsyncDisposableStack()can only be constructed withnew. Attempting to call it withoutnewthrows a TypeError.
Parameters
None.
Return value
A new AsyncDisposableStack object.
Examples
Creating an AsyncDisposableStack
const disposer = new AsyncDisposableStack();
disposer.defer(() => console.log("Disposed!"));
await disposer.disposeAsync();
// Logs: Disposed!