Documentación offline JavaScript main

AsyncDisposableStack() constructor

main Documentación oficial Licencia CC-BY-SA-2.5Descargado el 2026-08-02

En esta página

The AsyncDisposableStack() constructor creates {{jsxref("AsyncDisposableStack")}} objects.

Syntax#

new AsyncDisposableStack()

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

{{Specifications}}

Browser compatibility#

{{Compat}}

See also#