大网数据广告活动
Web 标准与前端开发

AsyncDisposableStack

· 52CE 我爱测

The **`AsyncDisposableStack`** object represents a stack of async disposers 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

The AsyncDisposableStack object represents a stack of async disposers 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 DisposableStack for general information about using disposable stacks.

Constructor

  • AsyncDisposableStack/AsyncDisposableStack
    • : Creates a new AsyncDisposableStack object.

Instance properties

These properties are defined on AsyncDisposableStack.prototype and shared by all AsyncDisposableStack instances.

  • Object/constructor
    • : The constructor function that created the instance object. For AsyncDisposableStack instances, the initial value is the AsyncDisposableStack/AsyncDisposableStack constructor.
  • AsyncDisposableStack.prototype.disposed
    • : 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] property is the string "AsyncDisposableStack". This property is used in Object.prototype.toString().

Instance methods

  • AsyncDisposableStack.prototype.adopt()
    • : Registers a value that doesn't implement the async disposable protocol to the stack by providing a custom disposer function.
  • AsyncDisposableStack.prototype.disposeAsync()
    • : Disposes this stack by calling all disposers registered to it in reverse order of registration.
  • AsyncDisposableStack.prototype.defer()
    • : Takes a callback function to be called when the stack is disposed.
  • AsyncDisposableStack.prototype.move()
    • : Creates a new AsyncDisposableStack instance that contains the same disposers as this stack, and then marks this stack as disposed, without calling any disposers.
  • AsyncDisposableStack.prototype.use()
    • : Registers a value that implements the async disposable protocol to the stack.
  • AsyncDisposableStack.prototype[Symbol.asyncDispose]
    • : An alias for the disposeAsync() method.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。