Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "disposable/index"

Index

Variables

Const EVENT_DISPOSED

EVENT_DISPOSED: "disposed" = "disposed"

Name of the event, when an object has been disposed.

Const EVENT_DISPOSING

EVENT_DISPOSING: "disposing" = "disposing"

Name of an event, when an object is going to be disposed.

Functions

makeNonDisposable

  • makeNonDisposable<TObj>(obj: TObj, throwOnDispose?: boolean): TObj
  • Clones an object and makes it non disposable.

    Type parameters

    • TObj: vscode.Disposable

    Parameters

    • obj: TObj

      The object to clone.

    • Default value throwOnDispose: boolean = true

    Returns TObj

    The cloned object.

tryDispose

  • tryDispose(obj: vscode.Disposable): boolean
  • Tries to dispose an object.

    Parameters

    • obj: vscode.Disposable

      The object to dispose.

    Returns boolean

    Operation was successful or not.

tryDisposeAndDelete

  • tryDisposeAndDelete(obj: any, key: PropertyKey, alwaysDelete?: boolean): false | vscode.Disposable
  • Tries to dispose an object inside another, parent object and deletes it there.

    Parameters

    • obj: any

      The "other" / parent object.

    • key: PropertyKey

      The key inside 'obj', where the disposable object is stored and should be removed.

    • Default value alwaysDelete: boolean = true

    Returns false | vscode.Disposable

    The disposed and removed object or (false) if failed.

using

  • using<TObj, TResult>(obj: TObj, func: function, ...args: any[]): Promise<TResult>
  • Invokes a function for a disposable object and keeps sure, that this object will be disposed, even on error.

    Type parameters

    • TObj: vscode.Disposable

    • TResult

    Parameters

    • obj: TObj

      The object.

    • func: function

      The function to invoke.

        • (o: TObj, ...args: any[]): TResult | PromiseLike<TResult>
        • Parameters

          • o: TObj
          • Rest ...args: any[]

          Returns TResult | PromiseLike<TResult>

    • Rest ...args: any[]

    Returns Promise<TResult>

    Promise The promise with the result of the function.

usingSync

  • usingSync<TObj, TResult>(obj: TObj, func: function, ...args: any[]): TResult
  • Invokes a function for a disposable object sync and keeps sure, that this object will be disposed, even on error.

    Type parameters

    • TObj: vscode.Disposable

    • TResult

    Parameters

    • obj: TObj

      The object.

    • func: function

      The function to invoke.

        • (o: TObj, ...args: any[]): TResult
        • Parameters

          • o: TObj
          • Rest ...args: any[]

          Returns TResult

    • Rest ...args: any[]

    Returns TResult

    TResult The result of the function.

Generated using TypeDoc