Skip to content

Commit

Permalink
locks: Type PresenceMessage.extras
Browse files Browse the repository at this point in the history
Signed-off-by: Lewis Marshall <lewis.marshall@ably.com>
  • Loading branch information
lmars committed Aug 11, 2023
1 parent e58bcc4 commit ba509cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ class Space extends EventEmitter<SpaceEventsMap> {
this.locks = new Locks(this, this.presenceUpdate);
}

private presenceUpdate = (data: PresenceMember['data'], extras?: any) => {
private presenceUpdate = (data: PresenceMember['data'], extras?: PresenceMember['extras']) => {
if (!extras) {
return this.channel.presence.update(data);
}
return this.channel.presence.update(Ably.Realtime.PresenceMessage.fromValues({ data, extras }));
};

private presenceEnter = (data: PresenceMember['data'], extras?: any) => {
private presenceEnter = (data: PresenceMember['data'], extras?: PresenceMember['extras']) => {
if (!extras) {
return this.channel.presence.enter(data);
}
return this.channel.presence.enter(Ably.Realtime.PresenceMessage.fromValues({ data, extras }));
};

private presenceLeave = (data: PresenceMember['data'], extras?: any) => {
private presenceLeave = (data: PresenceMember['data'], extras?: PresenceMember['extras']) => {
if (!extras) {
return this.channel.presence.leave(data);
}
Expand Down
4 changes: 4 additions & 0 deletions src/utilities/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Types } from 'ably';

import { EventKey, EventListener, EventMap } from './EventEmitter.js';
import { ProfileData } from '../types.js';
import { LockRequest } from '../Locks.js';

export type PresenceMember = {
data: {
Expand All @@ -15,6 +16,9 @@ export type PresenceMember = {
current: unknown;
};
};
extras?: {
locks: LockRequest[];
};
} & Omit<Types.PresenceMessage, 'data'>;

export type Subset<K> = {
Expand Down

0 comments on commit ba509cc

Please sign in to comment.