@liveblocks/react 0.12.0-beta.1 → 0.12.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Client, Others, Presence, LiveRecord, LiveList, RecordData, User } from "@liveblocks/client";
1
+ import { Client, Others, Presence, LiveObject, LiveMap, User, LiveList } from "@liveblocks/client";
2
2
  import * as React from "react";
3
3
  declare type LiveblocksProviderProps = {
4
4
  children: React.ReactNode;
@@ -125,9 +125,10 @@ export declare function useEventListener<TEvent>(callback: ({ connectionId, even
125
125
  * const user = useSelf();
126
126
  */
127
127
  export declare function useSelf<TPresence extends Presence = Presence>(): User<TPresence> | null;
128
- export declare function useStorage<TRoot extends RecordData>(): [
129
- root: LiveRecord<TRoot> | null
128
+ export declare function useStorage<TRoot extends Record<string, any>>(): [
129
+ root: LiveObject<TRoot> | null
130
130
  ];
131
- export declare function useRecord<TData>(record: LiveRecord<TData>): TData;
132
- export declare function useList<T extends LiveRecord>(list: LiveList<T>): T[];
131
+ export declare function useMap<TKey extends string, TValue>(key: string): LiveMap<TKey, TValue> | null;
132
+ export declare function useList<TValue>(key: string): LiveList<TValue> | null;
133
+ export declare function useObject<TData>(key: string): LiveObject<TData> | null;
133
134
  export {};
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
+ var client = require('@liveblocks/client');
3
4
  var React = require('react');
4
5
 
5
6
  /*! *****************************************************************************
@@ -17,17 +18,6 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
18
  PERFORMANCE OF THIS SOFTWARE.
18
19
  ***************************************************************************** */
19
20
 
20
- var __assign = function() {
21
- __assign = Object.assign || function __assign(t) {
22
- for (var s, i = 1, n = arguments.length; i < n; i++) {
23
- s = arguments[i];
24
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
25
- }
26
- return t;
27
- };
28
- return __assign.apply(this, arguments);
29
- };
30
-
31
21
  function __awaiter(thisArg, _arguments, P, generator) {
32
22
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33
23
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -310,31 +300,77 @@ function useStorage() {
310
300
  }, [room]);
311
301
  return [root];
312
302
  }
313
- function useRecord(record) {
314
- var _a = React.useState(record.toObject()), data = _a[0], setData = _a[1];
303
+ function useMap(key) {
304
+ var _a;
305
+ var root = useStorage()[0];
306
+ var _b = React.useState(0), setCount = _b[1];
315
307
  React.useEffect(function () {
308
+ if (root == null) {
309
+ return;
310
+ }
311
+ var map = root.get(key);
312
+ if (map == null) {
313
+ map = new client.LiveMap();
314
+ root.set(key, map);
315
+ }
316
316
  function onChange() {
317
- setData(__assign({}, record.toObject()));
317
+ setCount(function (x) { return x + 1; });
318
318
  }
319
- record.subscribe(onChange);
319
+ map.subscribe(onChange);
320
+ setCount(function (x) { return x + 1; });
320
321
  return function () {
321
- record.unsubscribe(onChange);
322
+ return map.unsubscribe(onChange);
322
323
  };
323
- }, [record]);
324
- return data;
324
+ }, [root]);
325
+ return (_a = root === null || root === void 0 ? void 0 : root.get(key)) !== null && _a !== void 0 ? _a : null;
325
326
  }
326
- function useList(list) {
327
- var _a = React.useState(list.toArray()), items = _a[0], setItems = _a[1];
327
+ function useList(key) {
328
+ var _a;
329
+ var root = useStorage()[0];
330
+ var _b = React.useState(0), setCount = _b[1];
328
331
  React.useEffect(function () {
332
+ if (root == null) {
333
+ return;
334
+ }
335
+ var list = root.get(key);
336
+ if (list == null) {
337
+ list = new client.LiveList();
338
+ root.set(key, list);
339
+ }
329
340
  function onChange() {
330
- setItems(list.toArray());
341
+ setCount(function (x) { return x + 1; });
331
342
  }
332
343
  list.subscribe(onChange);
344
+ setCount(function (x) { return x + 1; });
345
+ return function () {
346
+ return list.unsubscribe(onChange);
347
+ };
348
+ }, [root]);
349
+ return (_a = root === null || root === void 0 ? void 0 : root.get(key)) !== null && _a !== void 0 ? _a : null;
350
+ }
351
+ function useObject(key) {
352
+ var _a;
353
+ var root = useStorage()[0];
354
+ var _b = React.useState(0), setCount = _b[1];
355
+ React.useEffect(function () {
356
+ if (root == null) {
357
+ return;
358
+ }
359
+ var obj = root.get(key);
360
+ if (obj == null) {
361
+ obj = new client.LiveObject();
362
+ root.set(key, obj);
363
+ }
364
+ function onChange() {
365
+ setCount(function (x) { return x + 1; });
366
+ }
367
+ obj.subscribe(onChange);
368
+ setCount(function (x) { return x + 1; });
333
369
  return function () {
334
- list.unsubscribe(onChange);
370
+ return obj.unsubscribe(onChange);
335
371
  };
336
- }, [list]);
337
- return items;
372
+ }, [root]);
373
+ return (_a = root === null || root === void 0 ? void 0 : root.get(key)) !== null && _a !== void 0 ? _a : null;
338
374
  }
339
375
 
340
376
  exports.LiveblocksProvider = LiveblocksProvider;
@@ -343,9 +379,10 @@ exports.useBroadcastEvent = useBroadcastEvent;
343
379
  exports.useErrorListener = useErrorListener;
344
380
  exports.useEventListener = useEventListener;
345
381
  exports.useList = useList;
382
+ exports.useMap = useMap;
346
383
  exports.useMyPresence = useMyPresence;
384
+ exports.useObject = useObject;
347
385
  exports.useOthers = useOthers;
348
- exports.useRecord = useRecord;
349
386
  exports.useSelf = useSelf;
350
387
  exports.useStorage = useStorage;
351
388
  exports.useUpdateMyPresence = useUpdateMyPresence;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["import {\n Client,\n Others,\n Presence,\n LiveRecord,\n LiveList,\n RecordData,\n Room,\n User,\n} from \"@liveblocks/client\";\nimport * as React from \"react\";\n\ntype LiveblocksProviderProps = {\n children: React.ReactNode;\n client: Client;\n};\n\nconst ClientContext = React.createContext<Client | null>(null);\nconst RoomContext = React.createContext<Room | null>(null);\n\n/**\n * Makes the Liveblocks client available in the component hierarchy below.\n */\nexport function LiveblocksProvider(props: LiveblocksProviderProps) {\n return (\n <ClientContext.Provider value={props.client}>\n {props.children}\n </ClientContext.Provider>\n );\n}\n\n/**\n * Returns the client of the nearest LiveblocksProvider above in the react component tree\n */\nfunction useClient(): Client {\n const client = React.useContext(ClientContext);\n if (client == null) {\n throw new Error(\"LiveblocksProvider is missing from the react tree\");\n }\n\n return client;\n}\n\ntype RoomProviderProps<TStorageRoot> = {\n /**\n * The id of the room you want to connect to\n */\n id: string;\n /**\n * A callback that let you initialize the default presence when entering the room.\n * If ommited, the default presence will be an empty object\n */\n defaultPresence?: () => Presence;\n\n defaultStorageRoot?: TStorageRoot;\n\n children: React.ReactNode;\n};\n\n/**\n * Makes a Room available in the component hierarchy below.\n * When this component is unmounted, the current user leave the room.\n * That means that you can't have 2 RoomProvider with the same room id in your react tree.\n */\nexport function RoomProvider<TStorageRoot>({\n id,\n children,\n defaultPresence,\n defaultStorageRoot,\n}: RoomProviderProps<TStorageRoot>) {\n const client = useClient();\n\n React.useEffect(() => {\n return () => {\n client.leave(id);\n };\n }, [client, id]);\n\n const room =\n client.getRoom(id) ||\n client.enter(id, {\n defaultPresence: defaultPresence ? defaultPresence() : undefined,\n defaultStorageRoot,\n });\n\n return <RoomContext.Provider value={room}>{children}</RoomContext.Provider>;\n}\n\n/**\n * Returns the room of the nearest RoomProvider above in the react component tree\n */\nfunction useRoom() {\n const room = React.useContext(RoomContext);\n\n if (room == null) {\n throw new Error(\"RoomProvider is missing from the react tree\");\n }\n\n return room;\n}\n\n/**\n * Returns the presence of the current user of the current room, and a function to update it.\n * It is different from the setState function returned by the useState hook from React.\n * You don't need to pass the full presence object to update it.\n *\n * @example\n * import { useMyPresence } from \"@liveblocks/react\";\n *\n * const [myPresence, updateMyPresence] = useMyPresence();\n * updateMyPresence({ x: 0 });\n * updateMyPresence({ y: 0 });\n *\n * // At the next render, \"myPresence\" will be equal to \"{ x: 0, y: 0 }\"\n */\nexport function useMyPresence<T extends Presence>(): [\n T,\n (overrides: Partial<T>) => void\n] {\n const room = useRoom();\n const presence = room.getPresence<T>();\n const [, update] = React.useState(0);\n\n React.useEffect(() => {\n function onMyPresenceChange() {\n update((x) => x + 1);\n }\n\n room.subscribe(\"my-presence\", onMyPresenceChange);\n\n return () => {\n room.unsubscribe(\"my-presence\", onMyPresenceChange);\n };\n }, [room]);\n\n const setPresence = React.useCallback(\n (overrides: Partial<T>) => room.updatePresence(overrides),\n [room]\n );\n\n return [presence, setPresence];\n}\n\n/**\n * useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.\n * If you don't use the current user presence in your component, but you need to update it (e.g. live cursor), it's better to use useUpdateMyPresence to avoid unnecessary renders.\n *\n * @example\n * import { useUpdateMyPresence } from \"@liveblocks/react\";\n *\n * const updateMyPresence = useUpdateMyPresence();\n * updateMyPresence({ x: 0 });\n * updateMyPresence({ y: 0 });\n *\n * // At the next render, the presence of the current user will be equal to \"{ x: 0, y: 0 }\"\n */\nexport function useUpdateMyPresence<T extends Presence>(): (\n overrides: Partial<T>\n) => void {\n const room = useRoom();\n\n return React.useCallback(\n (overrides: Partial<T>) => {\n room.updatePresence(overrides);\n },\n [room]\n );\n}\n\n/**\n * Returns an object that lets you get information about all the the users currently connected in the room.\n *\n * @example\n * import { useOthers } from \"@liveblocks/react\";\n *\n * const others = useOthers();\n *\n * // Example to map all cursors in jsx\n * {\n * others.map(({ connectionId, presence }) => {\n * if(presence == null || presence.cursor == null) {\n * return null;\n * }\n * return <Cursor key={connectionId} cursor={presence.cursor} />\n * })\n * }\n */\nexport function useOthers<T extends Presence>(): Others<T> {\n const room = useRoom();\n\n const [, update] = React.useState(0);\n\n React.useEffect(() => {\n function onOthersChange() {\n update((x) => x + 1);\n }\n\n room.subscribe(\"others\", onOthersChange);\n\n return () => {\n room.subscribe(\"others\", onOthersChange);\n };\n }, [room]);\n\n return room.getOthers();\n}\n\n/**\n * Returns a callback that lets you broadcast custom events to other users in the room\n *\n * @example\n * import { useBroadcastEvent } from \"@liveblocks/react\";\n *\n * const broadcast = useBroadcastEvent();\n *\n * broadcast({ type: \"CUSTOM_EVENT\", data: { x: 0, y: 0 } });\n */\nexport function useBroadcastEvent() {\n const room = useRoom();\n\n return React.useCallback(\n (event: any) => {\n room.broadcastEvent(event);\n },\n [room]\n );\n}\n\n/**\n * useErrorListener is a react hook that lets you react to potential room connection errors.\n *\n * @example\n * import { useErrorListener } from \"@liveblocks/react\";\n *\n * useErrorListener(er => {\n * console.error(er);\n * })\n */\nexport function useErrorListener(callback: (er: Error) => void) {\n const room = useRoom();\n const savedCallback = React.useRef(callback);\n\n React.useEffect(() => {\n savedCallback.current = callback;\n });\n\n React.useEffect(() => {\n const listener = (e: Error) => savedCallback.current(e);\n\n room.subscribe(\"error\", listener);\n\n return () => {\n room.unsubscribe(\"error\", listener);\n };\n }, [room]);\n}\n\n/**\n * useEventListener is a react hook that lets you react to event broadcasted by other users in the room.\n *\n * @example\n * import { useEventListener } from \"@liveblocks/react\";\n *\n * useEventListener(({ connectionId, event }) => {\n * if (event.type === \"CUSTOM_EVENT\") {\n * // Do something\n * }\n * });\n */\nexport function useEventListener<TEvent>(\n callback: ({\n connectionId,\n event,\n }: {\n connectionId: number;\n event: TEvent;\n }) => void\n) {\n const room = useRoom();\n const savedCallback = React.useRef(callback);\n\n React.useEffect(() => {\n savedCallback.current = callback;\n });\n\n React.useEffect(() => {\n const listener = (e: { connectionId: number; event: TEvent }) =>\n savedCallback.current(e);\n\n room.subscribe(\"event\", listener);\n\n return () => {\n room.unsubscribe(\"event\", listener);\n };\n }, [room]);\n}\n\n/**\n * Gets the current user once it is connected to the room.\n *\n * @example\n * import { useSelf } from \"@liveblocks/react\";\n *\n * const user = useSelf();\n */\nexport function useSelf<\n TPresence extends Presence = Presence\n>(): User<TPresence> | null {\n const room = useRoom();\n const [, update] = React.useState(0);\n\n React.useEffect(() => {\n function onChange() {\n update((x) => x + 1);\n }\n\n room.subscribe(\"my-presence\", onChange);\n room.subscribe(\"connection\", onChange);\n\n return () => {\n room.unsubscribe(\"my-presence\", onChange);\n room.unsubscribe(\"connection\", onChange);\n };\n }, [room]);\n\n return room.getSelf<TPresence>();\n}\n\nexport function useStorage<TRoot extends RecordData>(): [\n root: LiveRecord<TRoot> | null\n] {\n const room = useRoom();\n const [root, setState] = React.useState<LiveRecord<TRoot> | null>(null);\n\n React.useEffect(() => {\n async function fetchStorage() {\n const storage = await room.getStorage<TRoot>();\n setState(storage.root);\n }\n\n fetchStorage();\n\n return () => {};\n }, [room]);\n\n return [root];\n}\n\nexport function useRecord<TData>(record: LiveRecord<TData>) {\n const [data, setData] = React.useState<TData>(record.toObject());\n\n React.useEffect(() => {\n function onChange() {\n setData({ ...record.toObject() });\n }\n\n record.subscribe(onChange);\n\n return () => {\n record.unsubscribe(onChange);\n };\n }, [record]);\n\n return data;\n}\n\nexport function useList<T extends LiveRecord>(list: LiveList<T>) {\n const [items, setItems] = React.useState<T[]>(list.toArray());\n\n React.useEffect(() => {\n function onChange() {\n setItems(list.toArray());\n }\n\n list.subscribe(onChange);\n\n return () => {\n list.unsubscribe(onChange);\n };\n }, [list]);\n\n return items;\n}\n"],"names":["React.createContext","React.createElement","React.useContext","React.useEffect","React.useState","React.useCallback","React.useRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAM,aAAa,GAAGA,mBAAmB,CAAgB,IAAI,CAAC,CAAC;AAC/D,IAAM,WAAW,GAAGA,mBAAmB,CAAc,IAAI,CAAC,CAAC;AAE3D;;;SAGgB,kBAAkB,CAAC,KAA8B;IAC/D,QACEC,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,IACxC,KAAK,CAAC,QAAQ,CACQ,EACzB;AACJ,CAAC;AAED;;;AAGA,SAAS,SAAS;IAChB,IAAM,MAAM,GAAGC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC/C,IAAI,MAAM,IAAI,IAAI,EA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M,CAAC,QAAQ,EAAE,EAAG,CAAC;SACnC;QAED,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE3B,OAAO;YACL,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SAC9B,CAAC;KACH,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,IAAI,CAAC;AACd,CAAC;SAEe,OAAO,CAAuB,IAAiB;IACvD,IAAA,KAAoBC,cAAc,CAAM,IAAI,CAAC,OAAO,EAAE,CAAC,EAAtD,KAAK,QAAA,EAAE,QAAQ,QAAuC,CAAC;IAE9DD,eAAe,CAAC;QACd,SAAS,QAAQ;YACf,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;SAC1B;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEzB,OAAO;YACL,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SAC5B,CAAC;KACH,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,KAAK,CAAC;AACf;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["import {\n Client,\n Others,\n Presence,\n LiveObject,\n LiveMap,\n Room,\n User,\n LiveList,\n} from \"@liveblocks/client\";\nimport * as React from \"react\";\n\ntype LiveblocksProviderProps = {\n children: React.ReactNode;\n client: Client;\n};\n\nconst ClientContext = React.createContext<Client | null>(null);\nconst RoomContext = React.createContext<Room | null>(null);\n\n/**\n * Makes the Liveblocks client available in the component hierarchy below.\n */\nexport function LiveblocksProvider(props: LiveblocksProviderProps) {\n return (\n <ClientContext.Provider value={props.client}>\n {props.children}\n </ClientContext.Provider>\n );\n}\n\n/**\n * Returns the client of the nearest LiveblocksProvider above in the react component tree\n */\nfunction useClient(): Client {\n const client = React.useContext(ClientContext);\n if (client == null) {\n throw new Error(\"LiveblocksProvider is missing from the react tree\");\n }\n\n return client;\n}\n\ntype RoomProviderProps<TStorageRoot> = {\n /**\n * The id of the room you want to connect to\n */\n id: string;\n /**\n * A callback that let you initialize the default presence when entering the room.\n * If ommited, the default presence will be an empty object\n */\n defaultPresence?: () => Presence;\n\n defaultStorageRoot?: TStorageRoot;\n\n children: React.ReactNode;\n};\n\n/**\n * Makes a Room available in the component hierarchy below.\n * When this component is unmounted, the current user leave the room.\n * That means that you can't have 2 RoomProvider with the same room id in your react tree.\n */\nexport function RoomProvider<TStorageRoot>({\n id,\n children,\n defaultPresence,\n defaultStorageRoot,\n}: RoomProviderProps<TStorageRoot>) {\n const client = useClient();\n\n React.useEffect(() => {\n return () => {\n client.leave(id);\n };\n }, [client, id]);\n\n const room =\n client.getRoom(id) ||\n client.enter(id, {\n defaultPresence: defaultPresence ? defaultPresence() : undefined,\n defaultStorageRoot,\n });\n\n return <RoomContext.Provider value={room}>{children}</RoomContext.Provider>;\n}\n\n/**\n * Returns the room of the nearest RoomProvider above in the react component tree\n */\nfunction useRoom() {\n const room = React.useContext(RoomContext);\n\n if (room == null) {\n throw new Error(\"RoomProvider is missing from the react tree\");\n }\n\n return room;\n}\n\n/**\n * Returns the presence of the current user of the current room, and a function to update it.\n * It is different from the setState function returned by the useState hook from React.\n * You don't need to pass the full presence object to update it.\n *\n * @example\n * import { useMyPresence } from \"@liveblocks/react\";\n *\n * const [myPresence, updateMyPresence] = useMyPresence();\n * updateMyPresence({ x: 0 });\n * updateMyPresence({ y: 0 });\n *\n * // At the next render, \"myPresence\" will be equal to \"{ x: 0, y: 0 }\"\n */\nexport function useMyPresence<T extends Presence>(): [\n T,\n (overrides: Partial<T>) => void\n] {\n const room = useRoom();\n const presence = room.getPresence<T>();\n const [, update] = React.useState(0);\n\n React.useEffect(() => {\n function onMyPresenceChange() {\n update((x) => x + 1);\n }\n\n room.subscribe(\"my-presence\", onMyPresenceChange);\n\n return () => {\n room.unsubscribe(\"my-presence\", onMyPresenceChange);\n };\n }, [room]);\n\n const setPresence = React.useCallback(\n (overrides: Partial<T>) => room.updatePresence(overrides),\n [room]\n );\n\n return [presence, setPresence];\n}\n\n/**\n * useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.\n * If you don't use the current user presence in your component, but you need to update it (e.g. live cursor), it's better to use useUpdateMyPresence to avoid unnecessary renders.\n *\n * @example\n * import { useUpdateMyPresence } from \"@liveblocks/react\";\n *\n * const updateMyPresence = useUpdateMyPresence();\n * updateMyPresence({ x: 0 });\n * updateMyPresence({ y: 0 });\n *\n * // At the next render, the presence of the current user will be equal to \"{ x: 0, y: 0 }\"\n */\nexport function useUpdateMyPresence<T extends Presence>(): (\n overrides: Partial<T>\n) => void {\n const room = useRoom();\n\n return React.useCallback(\n (overrides: Partial<T>) => {\n room.updatePresence(overrides);\n },\n [room]\n );\n}\n\n/**\n * Returns an object that lets you get information about all the the users currently connected in the room.\n *\n * @example\n * import { useOthers } from \"@liveblocks/react\";\n *\n * const others = useOthers();\n *\n * // Example to map all cursors in jsx\n * {\n * others.map(({ connectionId, presence }) => {\n * if(presence == null || presence.cursor == null) {\n * return null;\n * }\n * return <Cursor key={connectionId} cursor={presence.cursor} />\n * })\n * }\n */\nexport function useOthers<T extends Presence>(): Others<T> {\n const room = useRoom();\n\n const [, update] = React.useState(0);\n\n React.useEffect(() => {\n function onOthersChange() {\n update((x) => x + 1);\n }\n\n room.subscribe(\"others\", onOthersChange);\n\n return () => {\n room.subscribe(\"others\", onOthersChange);\n };\n }, [room]);\n\n return room.getOthers();\n}\n\n/**\n * Returns a callback that lets you broadcast custom events to other users in the room\n *\n * @example\n * import { useBroadcastEvent } from \"@liveblocks/react\";\n *\n * const broadcast = useBroadcastEvent();\n *\n * broadcast({ type: \"CUSTOM_EVENT\", data: { x: 0, y: 0 } });\n */\nexport function useBroadcastEvent() {\n const room = useRoom();\n\n return React.useCallback(\n (event: any) => {\n room.broadcastEvent(event);\n },\n [room]\n );\n}\n\n/**\n * useErrorListener is a react hook that lets you react to potential room connection errors.\n *\n * @example\n * import { useErrorListener } from \"@liveblocks/react\";\n *\n * useErrorListener(er => {\n * console.error(er);\n * })\n */\nexport function useErrorListener(callback: (er: Error) => void) {\n const room = useRoom();\n const savedCallback = React.useRef(callback);\n\n React.useEffect(() => {\n savedCallback.current = callback;\n });\n\n React.useEffect(() => {\n const listener = (e: Error) => savedCallback.current(e);\n\n room.subscribe(\"error\", listener);\n\n return () => {\n room.unsubscribe(\"error\", listener);\n };\n }, [room]);\n}\n\n/**\n * useEventListener is a react hook that lets you react to event broadcasted by other users in the room.\n *\n * @example\n * import { useEventListener } from \"@liveblocks/react\";\n *\n * useEventListener(({ connectionId, event }) => {\n * if (event.type === \"CUSTOM_EVENT\") {\n * // Do something\n * }\n * });\n */\nexport function useEventListener<TEvent>(\n callback: ({\n connectionId,\n event,\n }: {\n connectionId: number;\n event: TEvent;\n }) => void\n) {\n const room = useRoom();\n const savedCallback = React.useRef(callback);\n\n React.useEffect(() => {\n savedCallback.current = callback;\n });\n\n React.useEffect(() => {\n const listener = (e: { connectionId: number; event: TEvent }) =>\n savedCallback.current(e);\n\n room.subscribe(\"event\", listener);\n\n return () => {\n room.unsubscribe(\"event\", listener);\n };\n }, [room]);\n}\n\n/**\n * Gets the current user once it is connected to the room.\n *\n * @example\n * import { useSelf } from \"@liveblocks/react\";\n *\n * const user = useSelf();\n */\nexport function useSelf<\n TPresence extends Presence = Presence\n>(): User<TPresence> | null {\n const room = useRoom();\n const [, update] = React.useState(0);\n\n React.useEffect(() => {\n function onChange() {\n update((x) => x + 1);\n }\n\n room.subscribe(\"my-presence\", onChange);\n room.subscribe(\"connection\", onChange);\n\n return () => {\n room.unsubscribe(\"my-presence\", onChange);\n room.unsubscribe(\"connection\", onChange);\n };\n }, [room]);\n\n return room.getSelf<TPresence>();\n}\n\nexport function useStorage<TRoot extends Record<string, any>>(): [\n root: LiveObject<TRoot> | null\n] {\n const room = useRoom();\n const [root, setState] = React.useState<LiveObject<TRoot> | null>(null);\n\n React.useEffect(() => {\n async function fetchStorage() {\n const storage = await room.getStorage<TRoot>();\n setState(storage.root);\n }\n\n fetchStorage();\n\n return () => {};\n }, [room]);\n\n return [root];\n}\n\nexport function useMap<TKey extends string, TValue>(\n key: string\n): LiveMap<TKey, TValue> | null {\n const [root] = useStorage();\n const [, setCount] = React.useState(0);\n\n React.useEffect(() => {\n if (root == null) {\n return;\n }\n\n let map: LiveMap<TKey, TValue> = root.get(key);\n\n if (map == null) {\n map = new LiveMap();\n root.set(key, map);\n }\n\n function onChange() {\n setCount((x) => x + 1);\n }\n\n map.subscribe(onChange);\n\n setCount((x) => x + 1);\n\n return () => {\n return map.unsubscribe(onChange);\n };\n }, [root]);\n\n return root?.get(key) ?? null;\n}\n\nexport function useList<TValue>(\n key: string,\n): LiveList<TValue> | null {\n const [root] = useStorage();\n const [, setCount] = React.useState(0);\n\n React.useEffect(() => {\n if (root == null) {\n return;\n }\n\n let list: LiveList<TValue> = root.get(key);\n\n if (list == null) {\n list = new LiveList();\n root.set(key, list);\n }\n\n function onChange() {\n setCount((x) => x + 1);\n }\n\n list.subscribe(onChange);\n\n setCount((x) => x + 1);\n\n return () => {\n return list.unsubscribe(onChange);\n };\n }, [root]);\n\n return root?.get(key) ?? null;\n}\n\nexport function useObject<TData>(\n key: string\n): LiveObject<TData> | null {\n const [root] = useStorage();\n const [, setCount] = React.useState(0);\n\n React.useEffect(() => {\n if (root == null) {\n return;\n }\n\n let obj: LiveObject<TData> = root.get(key);\n\n if (obj == null) {\n obj = new LiveObject();\n root.set(key, obj);\n }\n\n function onChange() {\n setCount((x) => x + 1);\n }\n\n obj.subscribe(onChange);\n\n setCount((x) => x + 1);\n\n return () => {\n return obj.unsubscribe(onChange);\n };\n }, [root]);\n\n return root?.get(key) ?? null;\n}\n"],"names":["React.createContext","React.createElement","React.useContext","React.useEffect","React.useState","React.useCallback","React.useRef","LiveMap","LiveList","LiveObject"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IA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,GAAG,CAAC,GAAA,CAAC,CAAC;SACxB;QAED,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAExB,QAAQ,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,GAAG,CAAC,GAAA,CAAC,CAAC;QAEvB,OAAO;YACL,OAAO,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SAClC,CAAC;KACH,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,aAAO,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,CAAC,GAAG,oCAAK,IAAI,CAAC;AAChC;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/react",
3
- "version": "0.12.0-beta.1",
3
+ "version": "0.12.0-beta.10",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "peerDependencies": {
26
- "@liveblocks/client": "0.12.0-beta.1",
26
+ "@liveblocks/client": "0.12.0-beta.10",
27
27
  "react": "^16.14.0 || ^17"
28
28
  },
29
29
  "devDependencies": {