UNPKG

actor-kit

Version:

Actor Kit is a library for running state machines in Cloudflare Workers, leveraging XState for robust state management. It provides a framework for managing the logic, lifecycle, persistence, synchronization, and access control of actors in a distributed

29 lines 1.33 kB
import React, { ReactNode } from "react"; import { StateValueFrom } from "xstate"; import type { ActorKitClientProps } from "./createActorKitClient"; import type { ActorKitClient, AnyActorKitStateMachine, CallerSnapshotFrom, ClientEventFrom, MatchesProps } from "./types"; export declare function createActorKitContext<TMachine extends AnyActorKitStateMachine>(actorType: string): { Provider: React.FC<{ children: ReactNode; } & Omit<ActorKitClientProps<TMachine>, "actorType">>; ProviderFromClient: React.FC<{ children: ReactNode; client: ActorKitClient<TMachine>; }>; useClient: () => ActorKitClient<TMachine>; useSelector: <T>(selector: (snapshot: CallerSnapshotFrom<TMachine>) => T) => T; useSend: () => (event: ClientEventFrom<TMachine>) => void; useMatches: (stateValue: StateValueFrom<TMachine>) => boolean; Matches: React.FC<MatchesProps<TMachine> & { children: ReactNode; }> & { create: (state: StateValueFrom<TMachine>, options?: { and?: StateValueFrom<TMachine>; or?: StateValueFrom<TMachine>; not?: boolean; }) => React.FC<Omit<MatchesProps<TMachine>, "state" | "and" | "or" | "not"> & { children: ReactNode; }>; }; }; //# sourceMappingURL=createActorKitContext.d.ts.map