Explicit Resource Management
Less than 1 minute
Explicit Resource Management
Note
This is only built-ins for this proposal, using
syntax support requires transpiler support.
Modules
esnext.symbol.dispose
esnext.disposable-stack.constructor
esnext.suppressed-error.constructor
esnext.iterator.dispose
Types
interface SymbolConstructor {
readonly dispose: unique symbol;
}
class DisposableStack {
constructor();
dispose(): void;
use<T = Disposable>(value: T): T;
adopt<T>(value: T, onDispose: (value: T) => void): T;
defer(onDispose: Function): undefined;
[Symbol.dispose](): undefined;
[Symbol.toStringTag]: "DisposableStack";
}
class SuppressedError extends Error {
constructor(error: any, suppressed: any, message?: string);
error: any;
suppressed: any;
message: string;
cause: any;
}
interface Iterator<T> {
[Symbol.dispose](): void;
}
Entry points
core-js/proposals/explicit-resource-management
core-js(-pure)/actual|full/symbol/dispose
core-js(-pure)/actual|full/disposable-stack
core-js(-pure)/actual|full/suppressed-error
core-js(-pure)/actual|full/iterator/dispose