@eleven-am/pondsocket 0.1.131 → 0.1.133
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/channel/channel.js +4 -1
- package/package.json +1 -1
- package/types.d.ts +11 -7
package/channel/channel.js
CHANGED
|
@@ -40,6 +40,9 @@ class Channel {
|
|
|
40
40
|
getAssigns() {
|
|
41
41
|
return __classPrivateFieldGet(this, _Channel_engine, "f").getAssigns();
|
|
42
42
|
}
|
|
43
|
+
getPresences() {
|
|
44
|
+
return __classPrivateFieldGet(this, _Channel_engine, "f").presenceEngine.getPresence();
|
|
45
|
+
}
|
|
43
46
|
getUserData(userId) {
|
|
44
47
|
return __classPrivateFieldGet(this, _Channel_engine, "f").getUserData(userId);
|
|
45
48
|
}
|
|
@@ -112,7 +115,7 @@ class ChannelEngine {
|
|
|
112
115
|
(_a = __classPrivateFieldGet(this, _ChannelEngine_presenceEngine, "f")) === null || _a === void 0 ? void 0 : _a.removePresence(userId, graceful);
|
|
113
116
|
if (__classPrivateFieldGet(this, _ChannelEngine_parentEngine, "f").leaveCallback) {
|
|
114
117
|
__classPrivateFieldGet(this, _ChannelEngine_parentEngine, "f").leaveCallback({
|
|
115
|
-
userId,
|
|
118
|
+
id: userId,
|
|
116
119
|
assigns: user,
|
|
117
120
|
channel: new Channel(this),
|
|
118
121
|
});
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -37,14 +37,13 @@ type IncomingConnection<Path> = EventParams<Path> & {
|
|
|
37
37
|
address: string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
interface LeaveEvent {
|
|
41
|
-
|
|
42
|
-
assigns:
|
|
43
|
-
channel: Channel
|
|
40
|
+
interface LeaveEvent<EventTypes extends PondEvenType = PondEvenType, PresenceType extends PondPresence = PondPresence, AssignType extends PondAssigns = PondAssigns> {
|
|
41
|
+
id: string;
|
|
42
|
+
assigns: AssignType;
|
|
43
|
+
channel: Channel<EventTypes, PresenceType, AssignType>;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
type LeaveCallback = (event: LeaveEvent) => void;
|
|
47
|
-
|
|
46
|
+
type LeaveCallback<EventTypes extends PondEvenType = PondEvenType, PresenceType extends PondPresence = PondPresence, AssignType extends PondAssigns = PondAssigns> = (event: LeaveEvent<EventTypes, PresenceType, AssignType>) => void;
|
|
48
47
|
|
|
49
48
|
type PondEvenType = { [key: string]: PondMessage };
|
|
50
49
|
|
|
@@ -204,6 +203,11 @@ export declare class Channel<EventType extends PondEvenType = PondEvenType, Pres
|
|
|
204
203
|
*/
|
|
205
204
|
getAssigns (): Record<string, AssignType>;
|
|
206
205
|
|
|
206
|
+
/**
|
|
207
|
+
* @desc Gets the current presence data for the channel.
|
|
208
|
+
*/
|
|
209
|
+
getPresence (): Record<string, PresenceType>;
|
|
210
|
+
|
|
207
211
|
/**
|
|
208
212
|
* @desc Gets the assign date for a specific user.
|
|
209
213
|
* @param userId - The id of the user to get the assign data for.
|
|
@@ -393,7 +397,7 @@ export declare class PondChannel <EventType extends PondEvenType = PondEvenType,
|
|
|
393
397
|
* @desc Handles the leave event for a user, can occur when a user disconnects or leaves a channel, use this to clean up any resources
|
|
394
398
|
* @param callback - The callback to execute when a user leaves
|
|
395
399
|
*/
|
|
396
|
-
public onLeave (callback: LeaveCallback): void;
|
|
400
|
+
public onLeave (callback: LeaveCallback<EventType, PresenceType, AssignType>): void;
|
|
397
401
|
|
|
398
402
|
/**
|
|
399
403
|
* @desc Gets a channel by name
|