Skip to main content

Async Explicit Resource Management

Less than 1 minutefeaturees-proposalmissing-example

Async Explicit Resource Managementopen in new window

Note

This is only built-ins for this proposal, using syntax support requires transpiler support.

Modules

Types

interface SymbolConstructor {
  readonly asyncDispose: unique symbol;
}
class AsyncDisposableStack {
  constructor();
  disposeAsync(): Promise<void>;
  use<T = AsyncDisposable | Disposable>(value: T): T;
  adopt<T>(value: T, onDispose: (value: T) => void | Promise<void>): T;
  defer(onDispose: Function): void;
  [Symbol.asyncDispose](): Promise<void>;
  [Symbol.toStringTag]: "AsyncDisposableStack";
}
interface AsyncDisposable {
  [Symbol.asyncDispose](): Promise<void>;
}

Entry points

core-js/proposals/async-explicit-resource-management
core-js(-pure)/full/symbol/async-dispose
core-js(-pure)/full/async-disposable-stack
core-js(-pure)/full/async-iterator/async-dispose