Firefox Tomorrow

javascript class

AsyncDisposableStack

View on MDN ↗

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

Instance properties

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

Instance methods

  • adopt()
    • : Registers a value that doesn’t implement the async disposable protocol to the stack by providing a custom disposer function.
  • disposeAsync()
    • : Disposes this stack by calling all disposers registered to it in reverse order of registration.
  • defer()
    • : Takes a callback function to be called when the stack is disposed.
  • 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.
  • use()
    • : Registers a value that implements the async disposable protocol to the stack.
  • AsyncDisposableStack.prototype[Symbol.asyncDispose]
    • : An alias for the disposeAsync() method.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also