AsyncDisposableStack.prototype.disposed

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

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
  • Calling its {{jsxref("AsyncDisposableStack/move", "move()")}} method
  • Declaring it with {{jsxref("Statements/await_using", "await using")}} and letting the variable go out of scope, which automatically calls the [[Symbol.asyncDispose]()](/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncDisposableStack/Symbol.asyncDispose) method.

Examples

Checking if a stack is disposed

js
const disposer = new AsyncDisposableStack();
console.log(disposer.disposed); // false
await disposer.disposeAsync();
console.log(disposer.disposed); // true

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • [Polyfill of AsyncDisposableStack.prototype.disposed in core-js](https://core-js.io/docs/features/ecmascript/explicit-resource-management)
  • JavaScript resource management