ECMAScript: Explicit Resource Management
Note
This is only built-ins for this Explicit Resource Management, using
syntax support requires transpiler support.
Modules
es.disposable-stack.constructor
, es.iterator.dispose
, es.async-disposable-stack.constructor
, es.async-iterator.async-dispose
.
class Symbol {
static asyncDispose: @@asyncDispose;
static dispose: @@dispose;
}
class DisposableStack {
constructor(): DisposableStack;
dispose(): undefined;
use(value: Disposable): value;
adopt(value: object, onDispose: Function): value;
defer(onDispose: Function): undefined;
move(): DisposableStack;
@@dispose(): undefined;
@@toStringTag: 'DisposableStack';
}
class AsyncDisposableStack {
constructor(): AsyncDisposableStack;
disposeAsync(): Promise<undefined>;
use(value: AsyncDisposable | Disposable): value;
adopt(value: object, onDispose: Function): value;
defer(onDispose: Function): undefined;
move(): AsyncDisposableStack;
@@asyncDispose(): Promise<undefined>;
@@toStringTag: 'AsyncDisposableStack';
}
class SuppressedError extends Error {
constructor(error: any, suppressed: any, message?: string): SuppressedError;
error: any;
suppressed: any;
message: string;
cause: any;
}
class Iterator {
@@dispose(): undefined;
}
class AsyncIterator {
@@asyncDispose(): Promise<undefined>;
}
CommonJS entry points
core-js(-pure)/es|stable|actual|full/disposable-stack
core-js(-pure)/es|stable|actual|full/async-disposable-stack
core-js(-pure)/es|stable|actual|full/iterator/dispose
core-js(-pure)/es|stable|actual|full/async-iterator/async-dispose