function aborted
Unstable
Usage in Deno
import { aborted } from "node:util";
aborted(signal: AbortSignal,resource: any,): Promise<void>
Listens to abort event on the provided signal
and
returns a promise that is fulfilled when the signal
is
aborted. If the passed resource
is garbage collected before the signal
is
aborted, the returned promise shall remain pending indefinitely.
import { aborted } from 'node:util'; const dependent = obtainSomethingAbortable(); aborted(dependent.signal, dependent).then(() => { // Do something when dependent is aborted. }); dependent.on('event', () => { dependent.abort(); });
Promise<void>