Skip to content

Commit

Permalink
Fix accidental non-tree-shakability of PresenceMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonWoolf committed Jan 9, 2025
1 parent e9be1c9 commit 31b9fb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/common/lib/types/presencemessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export async function _fromEncodedArray(
);
}

// for tree-shakability
export function fromValues(values: Properties<PresenceMessage>) {
return PresenceMessage.fromValues(values);
}

class PresenceMessage extends BaseMessage {
action?: string;

Expand Down
4 changes: 2 additions & 2 deletions src/platform/web/modular/presencemessage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as API from '../../../../ably';
import PresenceMessage, { fromEncoded, fromEncodedArray } from '../../../common/lib/types/presencemessage';
import { fromValues, fromEncoded, fromEncodedArray } from '../../../common/lib/types/presencemessage';
import { Crypto } from './crypto';
import Logger from '../../../common/lib/util/logger';

Expand All @@ -21,4 +21,4 @@ export const decodeEncryptedPresenceMessages = ((obj, options) => {
return fromEncodedArray(Logger.defaultLogger, Crypto, obj, options);
}) as API.PresenceMessageStatic['fromEncodedArray'];

export const constructPresenceMessage = PresenceMessage.fromValues as API.PresenceMessageStatic['fromValues'];
export const constructPresenceMessage = fromValues as API.PresenceMessageStatic['fromValues'];

0 comments on commit 31b9fb2

Please sign in to comment.