Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Synchronize with BCD v6.0.36
  • Loading branch information
OnkarRuikar committed Jul 29, 2025
commit af9e079e34af1cf4ffa84ab4d4e34dd1ad594e67
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: AsyncDisposableStack.prototype.adopt()
slug: Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/adopt
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.AsyncDisposableStack.adopt
sidebar: jsref
---

{{non-standard_header}}

The **`adopt()`** method of {{jsxref("AsyncDisposableStack")}} instances registers a value that doesn't implement the async disposable protocol to the stack by providing a custom disposer function.

See {{jsxref("DisposableStack.prototype.adopt()")}} for general information about the `adopt()` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: AsyncDisposableStack() constructor
slug: Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/AsyncDisposableStack
page-type: javascript-constructor
status:
- non-standard
browser-compat: javascript.builtins.AsyncDisposableStack.AsyncDisposableStack
sidebar: jsref
---

{{non-standard_header}}

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

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: AsyncDisposableStack.prototype.defer()
slug: Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/defer
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.AsyncDisposableStack.defer
sidebar: jsref
---

{{non-standard_header}}

The **`defer()`** method of {{jsxref("AsyncDisposableStack")}} instances takes a callback function to be called and awaited when the stack is disposed.

See {{jsxref("DisposableStack.prototype.defer()")}} for general information about the `defer()` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: AsyncDisposableStack.prototype.disposeAsync()
slug: Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/disposeAsync
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.AsyncDisposableStack.disposeAsync
sidebar: jsref
---

{{non-standard_header}}

The **`disposeAsync()`** method of {{jsxref("AsyncDisposableStack")}} instances disposes this stack by calling all disposers registered to it in reverse order of registration, awaiting for each one's completion before calling the next one. If the stack is already disposed, this method does nothing.

It performs the same action as `await using disposer = new AsyncDisposableStack()` at scope exit. It can be used if you need to clean up at a point other than scope exit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: AsyncDisposableStack.prototype.disposed
slug: Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/disposed
page-type: javascript-instance-accessor-property
status:
- non-standard
browser-compat: javascript.builtins.AsyncDisposableStack.disposed
sidebar: jsref
---

{{non-standard_header}}

The **`disposed`** accessor property of {{jsxref("AsyncDisposableStack")}} instances returns a boolean indicating whether or not this `AsyncDisposableStack` has been disposed or moved by doing any of the following:

- Calling its {{jsxref("AsyncDisposableStack/disposeAsync", "disposeAsync()")}} method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
title: AsyncDisposableStack
slug: Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack
page-type: javascript-class
status:
- non-standard
browser-compat: javascript.builtins.AsyncDisposableStack
sidebar: jsref
---

{{non-standard_header}}

The **`AsyncDisposableStack`** object represents a stack of [async disposers](/en-US/docs/Web/JavaScript/Reference/Statements/await_using) to run when the stack itself is disposed. Disposer functions are executed in reverse order of registration, with strong error handling guarantees. Calling its `move()` method will transfer responsibility for calling the current registered disposers to a new `AsyncDisposableStack` and prevent registering any additional disposers.

See {{jsxref("DisposableStack")}} for general information about using disposable stacks.

## Constructor

- {{jsxref("AsyncDisposableStack/AsyncDisposableStack", "AsyncDisposableStack()")}}
- {{jsxref("AsyncDisposableStack/AsyncDisposableStack", "AsyncDisposableStack()")}} {{non-standard_inline}}
- : Creates a new `AsyncDisposableStack` object.

## Instance properties
Expand All @@ -21,22 +25,22 @@ These properties are defined on `AsyncDisposableStack.prototype` and shared by a

- {{jsxref("Object/constructor", "AsyncDisposableStack.prototype.constructor")}}
- : The constructor function that created the instance object. For `AsyncDisposableStack` instances, the initial value is the {{jsxref("AsyncDisposableStack/AsyncDisposableStack", "AsyncDisposableStack")}} constructor.
- {{jsxref("AsyncDisposableStack.prototype.disposed")}}
- {{jsxref("AsyncDisposableStack.prototype.disposed")}} {{non-standard_inline}}
- : Read-only. Returns `true` if the `AsyncDisposableStack` has been disposed, or `false` if not.
- `AsyncDisposableStack.prototype[Symbol.toStringTag]`
- : The initial value of the [`[Symbol.toStringTag]`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag) property is the string `"AsyncDisposableStack"`. This property is used in {{jsxref("Object.prototype.toString()")}}.

## Instance methods

- {{jsxref("AsyncDisposableStack.prototype.adopt()")}}
- {{jsxref("AsyncDisposableStack.prototype.adopt()")}} {{non-standard_inline}}
- : Registers a value that doesn't implement the async disposable protocol to the stack by providing a custom disposer function.
- {{jsxref("AsyncDisposableStack.prototype.disposeAsync()")}}
- {{jsxref("AsyncDisposableStack.prototype.disposeAsync()")}} {{non-standard_inline}}
- : Disposes this stack by calling all disposers registered to it in reverse order of registration.
- {{jsxref("AsyncDisposableStack.prototype.defer()")}}
- {{jsxref("AsyncDisposableStack.prototype.defer()")}} {{non-standard_inline}}
- : Takes a callback function to be called when the stack is disposed.
- {{jsxref("AsyncDisposableStack.prototype.move()")}}
- {{jsxref("AsyncDisposableStack.prototype.move()")}} {{non-standard_inline}}
- : Creates a new `AsyncDisposableStack` instance that contains the same disposers as this stack, and then marks this stack as disposed, without calling any disposers.
- {{jsxref("AsyncDisposableStack.prototype.use()")}}
- {{jsxref("AsyncDisposableStack.prototype.use()")}} {{non-standard_inline}}
- : Registers a value that implements the async disposable protocol to the stack.
- [`AsyncDisposableStack.prototype[Symbol.asyncDispose]`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/Symbol.asyncDispose)
- : An alias for the `disposeAsync()` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: AsyncDisposableStack.prototype.move()
slug: Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/move
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.AsyncDisposableStack.move
sidebar: jsref
---

{{non-standard_header}}

The **`move()`** method of {{jsxref("AsyncDisposableStack")}} instances creates a new `AsyncDisposableStack` instance that contains the same disposers as this stack, and then marks this stack as disposed, without calling any disposers.

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: AsyncDisposableStack.prototype.use()
slug: Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/use
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.AsyncDisposableStack.use
sidebar: jsref
---

{{non-standard_header}}

The **`use()`** method of {{jsxref("AsyncDisposableStack")}} instances registers a value that implements the [async disposable protocol](/en-US/docs/Web/JavaScript/Guide/Resource_management) to the stack.

See {{jsxref("DisposableStack.prototype.use()")}} for general information about the `use()` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: DisposableStack.prototype.adopt()
slug: Web/JavaScript/Reference/Global_Objects/DisposableStack/adopt
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.DisposableStack.adopt
sidebar: jsref
---

{{non-standard_header}}

The **`adopt()`** method of {{jsxref("DisposableStack")}} instances registers a value that doesn't implement the disposable protocol to the stack by providing a custom disposer function.

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: DisposableStack.prototype.defer()
slug: Web/JavaScript/Reference/Global_Objects/DisposableStack/defer
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.DisposableStack.defer
sidebar: jsref
---

{{non-standard_header}}

The **`defer()`** method of {{jsxref("DisposableStack")}} instances takes a callback function to be called when the stack is disposed.

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: DisposableStack() constructor
slug: Web/JavaScript/Reference/Global_Objects/DisposableStack/DisposableStack
page-type: javascript-constructor
status:
- non-standard
browser-compat: javascript.builtins.DisposableStack.DisposableStack
sidebar: jsref
---

{{non-standard_header}}

The **`DisposableStack()`** constructor creates {{jsxref("DisposableStack")}} objects.

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: DisposableStack.prototype.dispose()
slug: Web/JavaScript/Reference/Global_Objects/DisposableStack/dispose
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.DisposableStack.dispose
sidebar: jsref
---

{{non-standard_header}}

The **`dispose()`** method of {{jsxref("DisposableStack")}} instances disposes this stack by calling all disposers registered to it in reverse order of registration. If the stack is already disposed, this method does nothing.

It performs the same action as `using disposer = new isposableStack()` at scope exit. It can be used if you need to clean up at a point other than scope exit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: DisposableStack.prototype.disposed
slug: Web/JavaScript/Reference/Global_Objects/DisposableStack/disposed
page-type: javascript-instance-accessor-property
status:
- non-standard
browser-compat: javascript.builtins.DisposableStack.disposed
sidebar: jsref
---

{{non-standard_header}}

The **`disposed`** accessor property of {{jsxref("DisposableStack")}} instances returns a boolean indicating whether or not this `DisposableStack` has been disposed or moved by doing any of the following:

- Calling its {{jsxref("DisposableStack/dispose", "dispose()")}} method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: DisposableStack
slug: Web/JavaScript/Reference/Global_Objects/DisposableStack
page-type: javascript-class
status:
- non-standard
browser-compat: javascript.builtins.DisposableStack
sidebar: jsref
---

{{non-standard_header}}

The **`DisposableStack`** object represents a stack of [disposers](/en-US/docs/Web/JavaScript/Reference/Statements/using) to run when the stack itself is disposed. Disposer functions are executed in reverse order of registration, with strong error handling guarantees. Calling its `move()` method will transfer responsibility for calling the current registered disposers to a new `DisposableStack` and prevent registering any additional disposers.

## Description
Expand Down Expand Up @@ -33,7 +37,7 @@ Functionally, these two code snippets are equivalent. However, the first one is

## Constructor

- {{jsxref("DisposableStack/DisposableStack", "DisposableStack()")}}
- {{jsxref("DisposableStack/DisposableStack", "DisposableStack()")}} {{non-standard_inline}}
- : Creates a new `DisposableStack` object.

## Instance properties
Expand All @@ -42,22 +46,22 @@ These properties are defined on `DisposableStack.prototype` and shared by all `D

- {{jsxref("Object/constructor", "DisposableStack.prototype.constructor")}}
- : The constructor function that created the instance object. For `DisposableStack` instances, the initial value is the {{jsxref("DisposableStack/DisposableStack", "DisposableStack")}} constructor.
- {{jsxref("DisposableStack.prototype.disposed")}}
- {{jsxref("DisposableStack.prototype.disposed")}} {{non-standard_inline}}
- : Read-only. Returns `true` if the `DisposableStack` has been disposed, or `false` if not.
- `DisposableStack.prototype[Symbol.toStringTag]`
- : The initial value of the [`[Symbol.toStringTag]`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag) property is the string `"DisposableStack"`. This property is used in {{jsxref("Object.prototype.toString()")}}.

## Instance methods

- {{jsxref("DisposableStack.prototype.adopt()")}}
- {{jsxref("DisposableStack.prototype.adopt()")}} {{non-standard_inline}}
- : Registers a value that doesn't implement the disposable protocol to the stack by providing a custom disposer function.
- {{jsxref("DisposableStack.prototype.defer()")}}
- {{jsxref("DisposableStack.prototype.defer()")}} {{non-standard_inline}}
- : Takes a callback function to be called when the stack is disposed.
- {{jsxref("DisposableStack.prototype.dispose()")}}
- {{jsxref("DisposableStack.prototype.dispose()")}} {{non-standard_inline}}
- : Disposes this stack by calling all disposers registered to it in reverse order of registration.
- {{jsxref("DisposableStack.prototype.move()")}}
- {{jsxref("DisposableStack.prototype.move()")}} {{non-standard_inline}}
- : Creates a new `DisposableStack` instance that contains the same disposers as this stack, and then marks this stack as disposed, without calling any disposers.
- {{jsxref("DisposableStack.prototype.use()")}}
- {{jsxref("DisposableStack.prototype.use()")}} {{non-standard_inline}}
- : Registers a value that implements the disposable protocol to the stack.
- [`DisposableStack.prototype[Symbol.dispose]`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/DisposableStack/Symbol.dispose)
- : An alias for the `dispose()` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: DisposableStack.prototype.move()
slug: Web/JavaScript/Reference/Global_Objects/DisposableStack/move
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.DisposableStack.move
sidebar: jsref
---

{{non-standard_header}}

The **`move()`** method of {{jsxref("DisposableStack")}} instances creates a new `DisposableStack` instance that contains the same disposers as this stack, and then marks this stack as disposed, without calling any disposers.

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: DisposableStack.prototype.use()
slug: Web/JavaScript/Reference/Global_Objects/DisposableStack/use
page-type: javascript-instance-method
status:
- non-standard
browser-compat: javascript.builtins.DisposableStack.use
sidebar: jsref
---

{{non-standard_header}}

The **`use()`** method of {{jsxref("DisposableStack")}} instances registers a value that implements the [disposable protocol](/en-US/docs/Web/JavaScript/Guide/Resource_management) to the stack.

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: SuppressedError
slug: Web/JavaScript/Reference/Global_Objects/SuppressedError
page-type: javascript-class
status:
- non-standard
browser-compat: javascript.builtins.SuppressedError
sidebar: jsref
---

{{non-standard_header}}

The **`SuppressedError`** object represents an error generated while handing another error. It is generated during resource disposal using {{jsxref("Statements/using", "using")}} or {{jsxref("Statements/await_using", "await using")}}.

Compared to {{jsxref("AggregateError")}}, `SuppressedError` is used to represent a single error that is suppressed by another error, while `AggregateError` represents a list of unrelated errors. It is possible, though, for a `SuppressedError` to contain a chain of suppressed errors (`e.suppressed.suppressed.suppressed...`). It is also semantically different from {{jsxref("Error/cause", "cause")}} because the error is not _caused_ by another error, but _happens when_ handling another error.
Expand All @@ -14,7 +18,7 @@ Compared to {{jsxref("AggregateError")}}, `SuppressedError` is used to represent

## Constructor

- {{jsxref("SuppressedError/SuppressedError", "SuppressedError()")}}
- {{jsxref("SuppressedError/SuppressedError", "SuppressedError()")}} {{non-standard_inline}}
- : Creates a new `SuppressedError` object.

## Instance properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: SuppressedError() constructor
slug: Web/JavaScript/Reference/Global_Objects/SuppressedError/SuppressedError
page-type: javascript-constructor
status:
- non-standard
browser-compat: javascript.builtins.SuppressedError.SuppressedError
sidebar: jsref
---

{{non-standard_header}}

The **`SuppressedError()`** constructor creates {{jsxref("SuppressedError")}} objects.

## Syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: Symbol.asyncDispose
slug: Web/JavaScript/Reference/Global_Objects/Symbol/asyncDispose
page-type: javascript-static-data-property
status:
- non-standard
browser-compat: javascript.builtins.Symbol.asyncDispose
sidebar: jsref
---

{{non-standard_header}}

The **`Symbol.asyncDispose`** static data property represents the [well-known symbol](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#well-known_symbols) `Symbol.asyncDispose`. The {{jsxref("Statements/await_using", "await using")}} declaration looks up this symbol on the variable initializer for the method to call when the variable goes out of scope.

## Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
title: Symbol.dispose
slug: Web/JavaScript/Reference/Global_Objects/Symbol/dispose
page-type: javascript-static-data-property
status:
- non-standard
browser-compat: javascript.builtins.Symbol.dispose
sidebar: jsref
---

{{non-standard_header}}

The **`Symbol.dispose`** static data property represents the [well-known symbol](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#well-known_symbols) `Symbol.dispose`. The {{jsxref("Statements/using", "using")}} declaration looks up this symbol on the variable initializer for the method to call when the variable goes out of scope.

## Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ The method {{jsxref("Object.getOwnPropertySymbols()")}} returns an array of Symb

The static properties are all well-known Symbols. In these Symbols' descriptions, we will use language like "`Symbol.hasInstance` is a method determining…", but bear in mind that this is referring to the semantic of an object's method having this Symbol as the method name (because well-known Symbols act as "protocols"), not describing the value of the Symbol itself.

- {{jsxref("Symbol.asyncDispose")}}
- {{jsxref("Symbol.asyncDispose")}} {{non-standard_inline}}
- : A method that disposes resources of the object asynchronously when the object goes out of scope. Used by the [`await using`](/en-US/docs/Web/JavaScript/Reference/Statements/await_using) declaration.
- {{jsxref("Symbol.asyncIterator")}}
- : A method that returns the default AsyncIterator for an object. Used by [`for await...of`](/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of).
- {{jsxref("Symbol.dispose")}}
- {{jsxref("Symbol.dispose")}} {{non-standard_inline}}
- : A method that disposes resources of the object when the object goes out of scope. Used by the [`using`](/en-US/docs/Web/JavaScript/Reference/Statements/using) declaration.
- {{jsxref("Symbol.hasInstance")}}
- : A method determining if a constructor object recognizes an object as its instance. Used by {{jsxref("Operators/instanceof", "instanceof")}}.
Expand Down
Loading