Firefox Tomorrow

javascript constructor

AsyncDisposableStack() constructor

View on MDN ↗

The AsyncDisposableStack() constructor creates AsyncDisposableStack objects.

Syntax

new AsyncDisposableStack()

[!NOTE] AsyncDisposableStack() can only be constructed with new. Attempting to call it without new throws 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!

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also