AbortSignal
Namespace: Vercel.AI.Util
public sealed class AbortSignalAbort signal that records the first reason.
Inheritance: object
Properties
Section titled “Properties”Aborted
Section titled “Aborted”public bool Aborted { get; }Whether Abort(object) has been called.
Value: bool
Reason
Section titled “Reason”public object? Reason { get; }Reason passed to the abort that won.
Value: object
Methods
Section titled “Methods”Abort(object?)
Section titled “Abort(object?)”public void Abort(object? reason)Aborts unless this signal is already aborted. Every handler runs, even when an earlier one throws. The first handler exception is rethrown after the last handler ran.
Parameters
| Name | Type | Description |
|---|---|---|
reason |
object |
AddAbortHandler(Action)
Section titled “AddAbortHandler(Action)”public void AddAbortHandler(Action handler)Runs <code class=“paramref”>handler</code> when aborted. Runs immediately if already aborted.
Parameters
| Name | Type | Description |
|---|---|---|
handler |
Action |
RemoveAbortHandler(Action)
Section titled “RemoveAbortHandler(Action)”public void RemoveAbortHandler(Action handler)Removes a handler added by AddAbortHandler(Action).
Parameters
| Name | Type | Description |
|---|---|---|
handler |
Action |
Timeout(int, Action<Action, int>?)
Section titled “Timeout(int, Action<Action, int>?)”public static AbortSignal Timeout(int timeoutMs, Action<Action, int>? schedule = null)Signal that aborts with TimeoutError after <code class=“paramref”>timeoutMs</code>.
Parameters
| Name | Type | Description |
|---|---|---|
timeoutMs |
int | |
schedule |
Action<Action, int> |
Returns: AbortSignal
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product