diff --git a/src/common/lib/types/presencemessage.ts b/src/common/lib/types/presencemessage.ts index f736d21e4..e7a46bc60 100644 --- a/src/common/lib/types/presencemessage.ts +++ b/src/common/lib/types/presencemessage.ts @@ -56,6 +56,11 @@ export async function _fromEncodedArray( ); } +// for tree-shakability +export function fromValues(values: Properties) { + return PresenceMessage.fromValues(values); +} + class PresenceMessage extends BaseMessage { action?: string; diff --git a/src/platform/web/modular/presencemessage.ts b/src/platform/web/modular/presencemessage.ts index 1c1cdaeb5..273517b45 100644 --- a/src/platform/web/modular/presencemessage.ts +++ b/src/platform/web/modular/presencemessage.ts @@ -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'; @@ -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'];