@liveblocks/client 0.18.0-beta0 → 0.18.0-beta3
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/.built-by-link-script +1 -1
- package/chunk-UV2F4F4R.js +2457 -0
- package/{index-4e7d8cac.d.ts → index-29762efc.d.ts} +23 -21
- package/index.d.ts +2 -2
- package/index.js +1511 -2188
- package/internal.d.ts +2 -2
- package/internal.js +330 -509
- package/internal.mjs +1 -0
- package/package.json +1 -1
- package/chunk-ZR7CHFN6.js +0 -3728
|
@@ -5,6 +5,18 @@ declare type Observable<T> = {
|
|
|
5
5
|
subscribeOnce(callback: Callback<T>): UnsubscribeCallback;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
declare type ReadonlyArrayWithLegacyMethods<T> = readonly T[] & {
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Prefer the normal .length property on arrays.
|
|
11
|
+
*/
|
|
12
|
+
readonly count: number;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Calling .toArray() is no longer needed
|
|
15
|
+
*/
|
|
16
|
+
readonly toArray: () => readonly T[];
|
|
17
|
+
};
|
|
18
|
+
declare function asArrayWithLegacyMethods<T>(arr: readonly T[]): ReadonlyArrayWithLegacyMethods<T>;
|
|
19
|
+
|
|
8
20
|
/**
|
|
9
21
|
* The LiveMap class is similar to a JavaScript Map that is synchronized on all clients.
|
|
10
22
|
* Keys should be a string, and values should be serializable to JSON.
|
|
@@ -452,16 +464,6 @@ declare type Client = {
|
|
|
452
464
|
*/
|
|
453
465
|
leave(roomId: string): void;
|
|
454
466
|
};
|
|
455
|
-
declare type ReadonlyArrayWithLegacyMethods<T> = readonly T[] & {
|
|
456
|
-
/**
|
|
457
|
-
* @deprecated Prefer the normal .length property on arrays.
|
|
458
|
-
*/
|
|
459
|
-
readonly count: number;
|
|
460
|
-
/**
|
|
461
|
-
* @deprecated Calling .toArray() is no longer needed
|
|
462
|
-
*/
|
|
463
|
-
readonly toArray: () => readonly T[];
|
|
464
|
-
};
|
|
465
467
|
/**
|
|
466
468
|
* Represents all the other users connected in the room. Treated as immutable.
|
|
467
469
|
*/
|
|
@@ -640,7 +642,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
640
642
|
*/
|
|
641
643
|
isSelfAware(): boolean;
|
|
642
644
|
getConnectionState(): ConnectionState;
|
|
643
|
-
subscribe: {
|
|
645
|
+
readonly subscribe: {
|
|
644
646
|
/**
|
|
645
647
|
* Subscribe to the current user presence updates.
|
|
646
648
|
*
|
|
@@ -744,7 +746,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
744
746
|
/**
|
|
745
747
|
* Room's history contains functions that let you undo and redo operation made on by the current client on the presence and storage.
|
|
746
748
|
*/
|
|
747
|
-
history: History;
|
|
749
|
+
readonly history: History;
|
|
748
750
|
/**
|
|
749
751
|
* Gets the current user.
|
|
750
752
|
* Returns null if not it is not yet connected to the room.
|
|
@@ -759,14 +761,14 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
759
761
|
* @example
|
|
760
762
|
* const presence = room.getPresence();
|
|
761
763
|
*/
|
|
762
|
-
getPresence
|
|
764
|
+
getPresence(): TPresence;
|
|
763
765
|
/**
|
|
764
766
|
* Gets all the other users in the room.
|
|
765
767
|
*
|
|
766
768
|
* @example
|
|
767
769
|
* const others = room.getOthers();
|
|
768
770
|
*/
|
|
769
|
-
getOthers
|
|
771
|
+
getOthers(): Others<TPresence, TUserMeta>;
|
|
770
772
|
/**
|
|
771
773
|
* Updates the presence of the current user. Only pass the properties you want to update. No need to send the full presence.
|
|
772
774
|
* @param patch A partial object that contains the properties you want to update.
|
|
@@ -779,12 +781,12 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
779
781
|
* const presence = room.getPresence();
|
|
780
782
|
* // presence is equivalent to { x: 0, y: 0 }
|
|
781
783
|
*/
|
|
782
|
-
updatePresence
|
|
784
|
+
updatePresence(patch: Partial<TPresence>, options?: {
|
|
783
785
|
/**
|
|
784
786
|
* Whether or not the presence should have an impact on the undo/redo history.
|
|
785
787
|
*/
|
|
786
788
|
addToHistory: boolean;
|
|
787
|
-
})
|
|
789
|
+
}): void;
|
|
788
790
|
/**
|
|
789
791
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
790
792
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -800,7 +802,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
800
802
|
* }
|
|
801
803
|
* });
|
|
802
804
|
*/
|
|
803
|
-
broadcastEvent
|
|
805
|
+
broadcastEvent(event: TRoomEvent, options?: BroadcastOptions): void;
|
|
804
806
|
/**
|
|
805
807
|
* Get the room's storage asynchronously.
|
|
806
808
|
* The storage's root is a {@link LiveObject}.
|
|
@@ -808,7 +810,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
808
810
|
* @example
|
|
809
811
|
* const { root } = await room.getStorage();
|
|
810
812
|
*/
|
|
811
|
-
getStorage
|
|
813
|
+
getStorage(): Promise<{
|
|
812
814
|
root: LiveObject<TStorage>;
|
|
813
815
|
}>;
|
|
814
816
|
/**
|
|
@@ -819,7 +821,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
819
821
|
* const root = room.getStorageSnapshot();
|
|
820
822
|
*/
|
|
821
823
|
getStorageSnapshot(): LiveObject<TStorage> | null;
|
|
822
|
-
events: {
|
|
824
|
+
readonly events: {
|
|
823
825
|
customEvent: Observable<{
|
|
824
826
|
connectionId: number;
|
|
825
827
|
event: TRoomEvent;
|
|
@@ -852,7 +854,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
852
854
|
* room.updatePresence({ cursor: { x: 100, y: 100 }});
|
|
853
855
|
* });
|
|
854
856
|
*/
|
|
855
|
-
batch
|
|
857
|
+
batch<T>(fn: () => T): T;
|
|
856
858
|
};
|
|
857
859
|
declare enum WebsocketCloseCodes {
|
|
858
860
|
CLOSE_ABNORMAL = 1006,
|
|
@@ -865,4 +867,4 @@ declare enum WebsocketCloseCodes {
|
|
|
865
867
|
CLOSE_WITHOUT_RETRY = 4999
|
|
866
868
|
}
|
|
867
869
|
|
|
868
|
-
export { BaseUserMeta as B, ClientOptions as C, History as H, Immutable as I, Json as J, LiveList as L, Others as O, Room as R, StorageUpdate as S, ToJson as T, User as U, WebsocketCloseCodes as W, Client as a, LiveMap as b, LiveObject as c, BroadcastOptions as d, ImmutableList as e, ImmutableMap as f, ImmutableObject as g, ImmutableRef as h, JsonObject as i, LiveStructure as j, Lson as k, LsonObject as l,
|
|
870
|
+
export { BaseUserMeta as B, ClientOptions as C, History as H, Immutable as I, Json as J, LiveList as L, Others as O, Room as R, StorageUpdate as S, ToJson as T, User as U, WebsocketCloseCodes as W, Client as a, LiveMap as b, LiveObject as c, BroadcastOptions as d, ImmutableList as e, ImmutableMap as f, ImmutableObject as g, ImmutableRef as h, JsonObject as i, LiveStructure as j, Lson as k, LsonObject as l, asArrayWithLegacyMethods as m, LiveNode as n, Resolve as o, RoomInitializers as p, ToImmutable as q, isJsonArray as r, isJsonObject as s, isJsonScalar as t };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientOptions, a as Client } from './index-
|
|
2
|
-
export { B as BaseUserMeta, d as BroadcastOptions, a as Client, H as History, I as Immutable, e as ImmutableList, f as ImmutableMap, g as ImmutableObject, h as ImmutableRef, J as Json, i as JsonObject, L as LiveList, b as LiveMap, c as LiveObject, j as LiveStructure, k as Lson, l as LsonObject, O as Others, R as Room, S as StorageUpdate, U as User } from './index-
|
|
1
|
+
import { C as ClientOptions, a as Client } from './index-29762efc.js';
|
|
2
|
+
export { B as BaseUserMeta, d as BroadcastOptions, a as Client, H as History, I as Immutable, e as ImmutableList, f as ImmutableMap, g as ImmutableObject, h as ImmutableRef, J as Json, i as JsonObject, L as LiveList, b as LiveMap, c as LiveObject, j as LiveStructure, k as Lson, l as LsonObject, O as Others, R as Room, S as StorageUpdate, U as User } from './index-29762efc.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create a client that will be responsible to communicate with liveblocks servers.
|