@liveblocks/client 0.15.9 → 0.15.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/esm/index.js +14 -5
- package/lib/esm/index.mjs +14 -5
- package/lib/index.d.ts +16 -9
- package/lib/index.js +23 -16
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -1623,11 +1623,20 @@ function makeOthers(presenceMap) {
|
|
|
1623
1623
|
const _a = presence, publicKeys = __objRest(_a, ["_hasReceivedInitialPresence"]);
|
|
1624
1624
|
return publicKeys;
|
|
1625
1625
|
});
|
|
1626
|
-
|
|
1627
|
-
count
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1626
|
+
return {
|
|
1627
|
+
get count() {
|
|
1628
|
+
return array.length;
|
|
1629
|
+
},
|
|
1630
|
+
[Symbol.iterator]() {
|
|
1631
|
+
return array[Symbol.iterator]();
|
|
1632
|
+
},
|
|
1633
|
+
map(callback) {
|
|
1634
|
+
return array.map(callback);
|
|
1635
|
+
},
|
|
1636
|
+
toArray() {
|
|
1637
|
+
return array;
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1631
1640
|
}
|
|
1632
1641
|
function makeStateMachine(state, context, mockedEffects) {
|
|
1633
1642
|
const effects = mockedEffects || {
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1623,11 +1623,20 @@ function makeOthers(presenceMap) {
|
|
|
1623
1623
|
const _a = presence, publicKeys = __objRest(_a, ["_hasReceivedInitialPresence"]);
|
|
1624
1624
|
return publicKeys;
|
|
1625
1625
|
});
|
|
1626
|
-
|
|
1627
|
-
count
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1626
|
+
return {
|
|
1627
|
+
get count() {
|
|
1628
|
+
return array.length;
|
|
1629
|
+
},
|
|
1630
|
+
[Symbol.iterator]() {
|
|
1631
|
+
return array[Symbol.iterator]();
|
|
1632
|
+
},
|
|
1633
|
+
map(callback) {
|
|
1634
|
+
return array.map(callback);
|
|
1635
|
+
},
|
|
1636
|
+
toArray() {
|
|
1637
|
+
return array;
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1631
1640
|
}
|
|
1632
1641
|
function makeStateMachine(state, context, mockedEffects) {
|
|
1633
1642
|
const effects = mockedEffects || {
|
package/lib/index.d.ts
CHANGED
|
@@ -232,20 +232,27 @@ declare type Client = {
|
|
|
232
232
|
*/
|
|
233
233
|
leave(roomId: string): void;
|
|
234
234
|
};
|
|
235
|
-
|
|
235
|
+
/**
|
|
236
|
+
* Represents all the other users connected in the room. Treated as immutable.
|
|
237
|
+
*/
|
|
238
|
+
interface Others<TPresence extends Presence = Presence> {
|
|
236
239
|
/**
|
|
237
|
-
*
|
|
240
|
+
* Number of other users in the room.
|
|
238
241
|
*/
|
|
239
242
|
readonly count: number;
|
|
240
243
|
/**
|
|
241
|
-
*
|
|
244
|
+
* Returns a new Iterator object that contains the users.
|
|
242
245
|
*/
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
[Symbol.iterator](): IterableIterator<User<TPresence>>;
|
|
247
|
+
/**
|
|
248
|
+
* Returns the array of connected users in room.
|
|
249
|
+
*/
|
|
250
|
+
toArray(): User<TPresence>[];
|
|
251
|
+
/**
|
|
252
|
+
* This function let you map over the connected users in the room.
|
|
253
|
+
*/
|
|
254
|
+
map<U>(callback: (user: User<TPresence>) => U): U[];
|
|
255
|
+
}
|
|
249
256
|
/**
|
|
250
257
|
* Represents a user connected in a room. Treated as immutable.
|
|
251
258
|
*/
|
package/lib/index.js
CHANGED
|
@@ -2430,26 +2430,33 @@ function makeIdFactory(connectionId) {
|
|
|
2430
2430
|
}
|
|
2431
2431
|
|
|
2432
2432
|
function makeOthers(presenceMap) {
|
|
2433
|
+
var _ref;
|
|
2434
|
+
|
|
2433
2435
|
var array = Object.values(presenceMap).map(function (presence) {
|
|
2434
2436
|
presence._hasReceivedInitialPresence;
|
|
2435
2437
|
var publicKeys = _objectWithoutPropertiesLoose(presence, ["_hasReceivedInitialPresence"]);
|
|
2436
2438
|
|
|
2437
2439
|
return publicKeys;
|
|
2438
2440
|
});
|
|
2439
|
-
|
|
2440
|
-
count
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
})
|
|
2445
|
-
|
|
2441
|
+
return _ref = {
|
|
2442
|
+
get count() {
|
|
2443
|
+
return array.length;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
}, _ref[Symbol.iterator] = function () {
|
|
2447
|
+
return array[Symbol.iterator]();
|
|
2448
|
+
}, _ref.map = function map(callback) {
|
|
2449
|
+
return array.map(callback);
|
|
2450
|
+
}, _ref.toArray = function toArray() {
|
|
2451
|
+
return array;
|
|
2452
|
+
}, _ref;
|
|
2446
2453
|
}
|
|
2447
2454
|
|
|
2448
2455
|
function makeStateMachine(state, context, mockedEffects) {
|
|
2449
2456
|
var effects = mockedEffects || {
|
|
2450
2457
|
authenticate: function authenticate(auth, createWebSocket) {
|
|
2451
|
-
return auth(context.room).then(function (
|
|
2452
|
-
var token =
|
|
2458
|
+
return auth(context.room).then(function (_ref2) {
|
|
2459
|
+
var token = _ref2.token;
|
|
2453
2460
|
|
|
2454
2461
|
if (state.connection.state !== "authenticating") {
|
|
2455
2462
|
return;
|
|
@@ -2635,13 +2642,13 @@ function makeStateMachine(state, context, mockedEffects) {
|
|
|
2635
2642
|
}
|
|
2636
2643
|
}
|
|
2637
2644
|
|
|
2638
|
-
function notify(
|
|
2639
|
-
var
|
|
2640
|
-
storageUpdates =
|
|
2641
|
-
|
|
2642
|
-
presence =
|
|
2643
|
-
|
|
2644
|
-
others =
|
|
2645
|
+
function notify(_ref3) {
|
|
2646
|
+
var _ref3$storageUpdates = _ref3.storageUpdates,
|
|
2647
|
+
storageUpdates = _ref3$storageUpdates === void 0 ? new Map() : _ref3$storageUpdates,
|
|
2648
|
+
_ref3$presence = _ref3.presence,
|
|
2649
|
+
presence = _ref3$presence === void 0 ? false : _ref3$presence,
|
|
2650
|
+
_ref3$others = _ref3.others,
|
|
2651
|
+
others = _ref3$others === void 0 ? [] : _ref3$others;
|
|
2645
2652
|
|
|
2646
2653
|
if (others.length > 0) {
|
|
2647
2654
|
state.others = makeOthers(state.users);
|