tapedb/react
Generiert aus den TypeScript-Deklarationen des öffentlichen tapedb/react-Entry-Points. Signaturen und Kommentare sind der API-Vertrag dieser Preview.
Functions
Abschnitt betitelt „Functions“useBroadcast
Abschnitt betitelt „useBroadcast“Listens on a broadcast topic while mounted and returns its send. The
latest onMessage is always the one called, so it need not be memoised.
declare function useBroadcast<T = unknown>(db: { $broadcast<M>(topic: string): BroadcastTopic<M>;}, topic: string, onMessage?: (message: T, from: TopicSender) => void): (message: T) => boolean;useLive
Abschnitt betitelt „useLive“Live results for a query: useLive(db.task.findMany({ where })).
A new query object every render is fine: the subscription follows the query’s key, not its identity, so equal arguments keep one subscription.
declare function useLive<T>(query: Query<T>): LiveState<T>;useLivePage
Abschnitt betitelt „useLivePage“Live pages: useLivePage(db.task.findPage({ orderBy, take: 50 })).
declare function useLivePage<R>(query: PageQuery<R>): LivePage<R>;usePresence
Abschnitt betitelt „usePresence“Joins a presence room with presence and returns the other peers. Leaves
the room on unmount; publishes again whenever presence changes.
declare function usePresence(db: { $presence(room: string): PresenceRoom;}, room: string, presence?: unknown): PresencePeer[];Interfaces
Abschnitt betitelt „Interfaces“LivePage
Abschnitt betitelt „LivePage“interface LivePage<R> { rows: R[]; hasMore: boolean; isLoading: boolean; error: LiveState<Page<R>>["error"]; /** Appends the next page; every loaded page stays live. */ loadMore(): Promise<boolean>;}