function aborted
unstable
Jump to headingaborted(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();
});
Parameters Jump to heading
Jump to headingsignal: AbortSignalJump to headingresource: anyAny non-null entity, reference to which is held weakly.
Return Type Jump to heading
Promise<void>