@liveblocks/react
Advanced tools
Comparing version 0.15.11 to 0.16.0
@@ -1,2 +0,3 @@ | ||
import { Room, Presence, Others, BroadcastOptions, User, LiveObject, LiveMap, LiveList, Client } from '@liveblocks/client'; | ||
import { Room, Presence, Others, BroadcastOptions, Json, User, LiveObject, Lson, LiveMap, LiveList, LsonObject, History, Client } from '@liveblocks/client'; | ||
export { Json, JsonObject } from '@liveblocks/client'; | ||
import * as React from 'react'; | ||
@@ -111,3 +112,3 @@ | ||
*/ | ||
declare function useErrorListener(callback: (er: Error) => void): void; | ||
declare function useErrorListener(callback: (err: Error) => void): void; | ||
/** | ||
@@ -125,3 +126,3 @@ * useEventListener is a react hook that lets you react to event broadcasted by other users in the room. | ||
*/ | ||
declare function useEventListener<TEvent>(callback: ({ connectionId, event, }: { | ||
declare function useEventListener<TEvent extends Json>(callback: ({ connectionId, event, }: { | ||
connectionId: number; | ||
@@ -154,3 +155,3 @@ event: TEvent; | ||
*/ | ||
declare function useMap<TKey extends string, TValue>(key: string, entries?: readonly (readonly [TKey, TValue])[] | null | undefined): LiveMap<TKey, TValue> | null; | ||
declare function useMap<TKey extends string, TValue extends Lson>(key: string, entries?: readonly (readonly [TKey, TValue])[] | null | undefined): LiveMap<TKey, TValue> | null; | ||
/** | ||
@@ -168,3 +169,3 @@ * Returns the LiveList associated with the provided key. If the LiveList does not exist, a new LiveList will be created. | ||
*/ | ||
declare function useList<TValue>(key: string, items?: TValue[] | undefined): LiveList<TValue> | null; | ||
declare function useList<TValue extends Lson>(key: string, items?: TValue[] | undefined): LiveList<TValue> | null; | ||
/** | ||
@@ -184,3 +185,3 @@ * Returns the LiveObject associated with the provided key. If the LiveObject does not exist, it will be created with the initialData parameter. | ||
*/ | ||
declare function useObject<TData>(key: string, initialData?: TData): LiveObject<TData> | null; | ||
declare function useObject<TData extends LsonObject>(key: string, initialData?: TData): LiveObject<TData> | null; | ||
/** | ||
@@ -202,13 +203,8 @@ * Returns a function that undoes the last operation executed by the current client. | ||
*/ | ||
declare function useBatch(): (fn: () => void) => void; | ||
declare function useBatch(): (callback: () => void) => void; | ||
/** | ||
* Returns the room.history | ||
*/ | ||
declare function useHistory(): { | ||
undo: () => void; | ||
redo: () => void; | ||
pause: () => void; | ||
resume: () => void; | ||
}; | ||
declare function useHistory(): History; | ||
export { LiveblocksProvider, RoomProvider, useBatch, useBroadcastEvent, useErrorListener, useEventListener, useHistory, useList, useMap, useMyPresence, useObject, useOthers, useRedo, useRoom, useSelf, useStorage, useUndo, useUpdateMyPresence }; |
{ | ||
"name": "@liveblocks/react", | ||
"version": "0.15.11", | ||
"description": "", | ||
"version": "0.16.0", | ||
"description": "A set of React hooks and providers to use Liveblocks declaratively.", | ||
"main": "./lib/index.js", | ||
@@ -36,3 +36,3 @@ "types": "./lib/index.d.ts", | ||
"peerDependencies": { | ||
"@liveblocks/client": "0.15.11", | ||
"@liveblocks/client": "0.16.0", | ||
"react": "^16.14.0 || ^17 || ^18" | ||
@@ -39,0 +39,0 @@ }, |
@@ -21,2 +21,4 @@ <p align="center"> | ||
A set of [React](https://reactjs.org/) hooks and providers to use [Liveblocks](https://liveblocks.io) declaratively. | ||
## Installation | ||
@@ -23,0 +25,0 @@ |
33237
53
925