Callbacks
Namespace: Vercel.AI.Util
public static class CallbacksInvokes callbacks and ignores individual failures.
Inheritance: object
Methods
Section titled “Methods”MergeCallbacks<TEvent>(params Func<TEvent, Task>?[])
Section titled “MergeCallbacks<TEvent>(params Func<TEvent, Task>?[])”public static Func<TEvent, Task> MergeCallbacks<TEvent>(params Func<TEvent, Task>?[] callbacks)Returns a callback that forwards each event to <code class=“paramref”>callbacks</code> in parallel and waits until they settle. Failures are ignored.
Type parameters
| Name | Description |
|---|---|
TEvent |
Parameters
| Name | Type | Description |
|---|---|---|
callbacks |
Func<TEvent, Task>[] |
Returns: Func<TEvent, Task>
NotifyAsync<T>(T, IEnumerable<Func<T, Task>?>?)
Section titled “NotifyAsync<T>(T, IEnumerable<Func<T, Task>?>?)”public static Task NotifyAsync<T>(T eventValue, IEnumerable<Func<T, Task>?>? callbacks)Invokes <code class=“paramref”>callbacks</code> in parallel with <code class=“paramref”>eventValue</code> and waits for them to settle. Null callbacks are skipped. Thrown and rejected callbacks are ignored.
Type parameters
| Name | Description |
|---|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
eventValue |
T |
|
callbacks |
IEnumerable<Func<T, Task>> |
Returns: Task
NotifyAsync<T>(T, Func<T, Task>?)
Section titled “NotifyAsync<T>(T, Func<T, Task>?)”public static Task NotifyAsync<T>(T eventValue, Func<T, Task>? callback)Notifies one callback. A null callback is ignored.
Type parameters
| Name | Description |
|---|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
eventValue |
T |
|
callback |
Func<T, Task> |
Returns: Task
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product