异步显式资源管理
小于 1 分钟
异步显式资源管理
注
只包含提案中内建的,using
语法需要转译支持。
模块
esnext.symbol.async-dispose
esnext.async-disposable-stack.constructor
esnext.async-iterator.async-dispose
类型
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>;
}
入口点
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