Library API
    Preparing search index...

    Function onAbort

    • Safely binds an abort callback to an AbortSignal.

      • If the signal is already aborted, invokes the callback immediately.
      • If a signal is provided, attaches an event listener with { once: true }.
      • Returns a cleanup unbind function to safely detach the listener early (preventing memory leaks).

      Parameters

      • signal: AbortSignal | undefined

        The AbortSignal to observe (optional)

      • callback: () => void

        The callback to execute upon abort

      Returns () => void

      A teardown function that detaches the abort listener