Skip to main content
aborted - node__util.d.ts - Node documentation
function aborted
Unstable

Usage in Deno

```typescript import { aborted } from "node:node__util.d.ts"; ```
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. ```js 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

signal: AbortSignal
resource: any
Any non-null entity, reference to which is held weakly.

Return Type

Promise<void>