Search e01
One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.
6 results across 6 corpora for AsyncDisposableStack.prototype.disposed.
Developer library 6
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.defer()
The **`defer()`** method of AsyncDisposableStack instances takes a callback function to be called and awaited when the stack is disposed. See DisposableStack.prototype.defer() for general information about the `defer()` method. ## Syntax ```js-nolint defer(onDispose) ``` ### Parameters - `onDispose` - : A function that will be called when the stack is disposed. The function receives no arguments and can return
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.adopt()
The **`adopt()`** method of AsyncDisposableStack instances registers a value that doesn't implement the async disposable protocol to the stack by providing a custom disposer function. See DisposableStack.prototype.adopt() for general information about the `adopt()` method. ## Syntax ```js-nolint adopt(value, onDispose) ``` ### Parameters - `value` - : Any value to be registered to the stack. - `onDispose` -
AsyncDisposableStack.prototype.use()
The **`use()`** method of AsyncDisposableStack instances registers a value that implements the [async disposable protocol](/docs/Web/JavaScript/Guide/Resource_management) to the stack. See DisposableStack.prototype.use() for general information about the `use()` method. ## Syntax ```js-nolint use(value) ``` ### Parameters - `value` - : The value to register to the stack. Must either contain a `[Symbol.asyncDis