Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
TypeScript
123456789101112131415161718192021222324252627282930import type { createOwnerClient } from "./owner-client";
export type SettingsConnection = ReturnType<typeof createOwnerClient> | null;export type SettingsConnectionProps = { connection: SettingsConnection; connected: boolean; connecting: boolean;};
// Agents 0.22 has RPC timeouts, but no per-call AbortSignal. Check cancellation// before and after the native call; Query cancellation cannot stop server work.export async function callOwner<T>( connection: SettingsConnection, method: string, args: unknown[] = [], signal?: AbortSignal,): Promise<T> { signal?.throwIfAborted(); if (!connection?.isReady() || !navigator.onLine) throw new Error("Owner connection unavailable"); const client = await connection.ready; signal?.throwIfAborted(); if (!connection.isReady() || !navigator.onLine) throw new Error("Owner connection retired"); const value = await client.call<T>(method, args); signal?.throwIfAborted(); if (!connection.isCurrent()) throw new Error("Owner connection retired"); return value;}