Skip to main content

Explicit Resource Management

Less than 1 minutefeaturees-proposalmissing-example

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 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