onAbort
Adds an abort listener to an abort signal and calls the callback if the abort signal is already aborted.
Import:
import { onAbort } from 'obsidian-dev-utils/abort-controller';Signature:
function onAbort(abortSignal: AbortSignal, callback: (abortSignal: AbortSignal) => void): DisposableParameters:
| Parameter | Type | Description |
|---|---|---|
abortSignal | AbortSignal | The abort signal to add the listener to. |
callback | (abortSignal: AbortSignal) => void | The callback to call when the abort signal aborts. |
Returns: Disposable — A Disposable that removes the abort listener when disposed, for use with using.