@tsdotnet/disposable - v2.0.1
    Preparing search index...

    Function single

    • Disposes a single object efficiently without creating arrays.

      Use this method when disposing only one object to avoid the overhead of creating an arguments array.

      Parameters

      • disposable: DisposableItem

        The object to dispose.

      • trapException: boolean = false

        If true, catches and logs exceptions instead of throwing them.

      Returns void

      const resource = new MyResource();
      dispose.single(resource); // Throws on error
      dispose.single(resource, true); // Logs errors instead of throwing