Search e01
One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.
5 results across 6 corpora for AsyncDisposableStack.prototype.disposeAsync().
Developer library 5
AsyncDisposableStack
The **`AsyncDisposableStack`** object represents a stack of [async disposers](/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 pr
AsyncDisposableStack.prototype[Symbol.asyncDispose]()
The **`[Symbol.asyncDispose]()`** method of AsyncDisposableStack instances implements the _async disposable protocol_ and allows it to be disposed when used with await using. It is an alias for the disposeAsync() method. ## Syntax ```js-nolint asyncDisposableStack[Symbol.asyncDispose]() ``` ### Parameters None. ### Return value None (undefined). ## Examples ### Declaring a stack with `await using` The `Symbo
AsyncDisposableStack.prototype.disposed
The **`disposed`** accessor property of AsyncDisposableStack instances returns a boolean indicating whether or not this `AsyncDisposableStack` has been disposed or moved by doing any of the following: - Calling its disposeAsync() method - Calling its move() method - Declaring it with await using and letting the variable go out of scope, which automatically calls the [`[Symbol.asyncDispose]()`](/docs/Web/JavaScript/R
AsyncDisposableStack.prototype.disposeAsync()
The **`disposeAsync()`** method of 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
AsyncDisposableStack.prototype.move()
The **`move()`** method of 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 ```js-nolint move() ``` ### Parameters None. ### Return value A new AsyncDisposableStack instance. ### Exceptions - ReferenceError - : Thrown if the stack is already disposed. #