# QueryAbortSignal (/docs/core/reference/api/interfaces/QueryAbortSignal)



[@kysoql/core](/docs/core/reference/api) / QueryAbortSignal

Minimal structural contract used for query cancellation.

Native `AbortSignal` instances satisfy this interface without requiring
`@kysoql/core` to depend on DOM or Node ambient types.

## Methods [#methods]

<a id="api-throwifaborted" />

### throwIfAborted() [#throwifaborted]

```ts
throwIfAborted(): void;
```

Throws the signal reason when cancellation has already been requested.

#### Returns [#returns]

`void`

***

<a id="api-addeventlistener" />

### addEventListener() [#addeventlistener]

```ts
addEventListener(
   type,
   listener,
   options?
): void;
```

Registers an abort listener using the `AbortSignal`-compatible contract.

#### Parameters [#parameters]

| Parameter       | Type                     | Description                                                    |
| --------------- | ------------------------ | -------------------------------------------------------------- |
| `type`          | `"abort"`                | -                                                              |
| `listener`      | () => `void`             | -                                                              |
| `options?`      | \{ `once?`: `boolean`; } | -                                                              |
| `options.once?` | `boolean`                | Remove the listener automatically after the first abort event. |

#### Returns [#returns-1]

`void`

***

<a id="api-removeeventlistener" />

### removeEventListener() [#removeeventlistener]

```ts
removeEventListener(type, listener): void;
```

Removes a previously registered abort listener.

#### Parameters [#parameters-1]

| Parameter  | Type         |
| ---------- | ------------ |
| `type`     | `"abort"`    |
| `listener` | () => `void` |

#### Returns [#returns-2]

`void`

## Properties [#properties]

| Property                                  | Modifier   | Type      | Description                                      |
| ----------------------------------------- | ---------- | --------- | ------------------------------------------------ |
| <a id="api-property-aborted" /> `aborted` | `readonly` | `boolean` | Whether cancellation has already been requested. |
| <a id="api-property-reason" /> `reason`   | `readonly` | `unknown` | Reason supplied when the signal was aborted.     |
