UNPKG

partysync

Version:

Experimental library to synchronize state between a Durable Object and client. See [design discussion](https://github.com/cloudflare/partykit/issues/147).

19 lines (16 loc) 363 B
import { WebSocket } from "partysocket"; declare function useSync< RecordType extends unknown[], Action extends { type: string; payload: unknown; } >( key: string, socket: WebSocket, optimisticReducer?: ( currentState: RecordType[], action: Action ) => RecordType[] ): [RecordType[], (action: Action) => void]; export { useSync };