@rivetkit/react
Version:
React hooks and components for RivetKit client applications
47 lines (44 loc) • 2.37 kB
text/typescript
import * as rivetkit_client from 'rivetkit/client';
import { createClient, ExtractActorsFromRegistry, Client } from 'rivetkit/client';
export { ActorConnDisposed, createClient } from 'rivetkit/client';
import { AnyActorRegistry, CreateRivetKitOptions, ActorOptions } from '@rivetkit/framework-base';
export { ActorConnStatus } from '@rivetkit/framework-base';
declare function createRivetKit<Registry extends AnyActorRegistry>(clientInput: Parameters<typeof createClient>[0], opts?: CreateRivetKitOptions<Registry>): {
useActor: <ActorName extends keyof ExtractActorsFromRegistry<Registry>>(opts: ActorOptions<Registry, ActorName>) => {
useEvent: (eventName: string, handler: (...args: any[]) => void) => void;
error: Error | null;
hash: string;
connStatus: rivetkit_client.ActorConnStatus;
opts: {
name: keyof ExtractActorsFromRegistry<Registry>;
key: string | string[];
params?: Record<string, string>;
createInRegion?: string;
createWithInput?: unknown;
enabled?: boolean;
};
handle: rivetkit_client.ActorHandle<ExtractActorsFromRegistry<Registry>[ActorName]> | null;
connection: rivetkit_client.ActorConn<ExtractActorsFromRegistry<Registry>[ActorName]> | null;
isConnected: boolean;
};
};
declare function createRivetKitWithClient<Registry extends AnyActorRegistry>(client: Client<Registry>, opts?: CreateRivetKitOptions<Registry>): {
useActor: <ActorName extends keyof ExtractActorsFromRegistry<Registry>>(opts: ActorOptions<Registry, ActorName>) => {
useEvent: (eventName: string, handler: (...args: any[]) => void) => void;
error: Error | null;
hash: string;
connStatus: rivetkit_client.ActorConnStatus;
opts: {
name: keyof ExtractActorsFromRegistry<Registry>;
key: string | string[];
params?: Record<string, string>;
createInRegion?: string;
createWithInput?: unknown;
enabled?: boolean;
};
handle: rivetkit_client.ActorHandle<ExtractActorsFromRegistry<Registry>[ActorName]> | null;
connection: rivetkit_client.ActorConn<ExtractActorsFromRegistry<Registry>[ActorName]> | null;
isConnected: boolean;
};
};
export { createRivetKit, createRivetKitWithClient };