TypedMessage

TypedMessage

new TypedMessage()

Source:
所有内置的富媒体消息均继承自本类

Extends

Members

attributes :Object

Source:
Type:
  • Object

(nullable) cid :String

Source:
Inherited From:
消息所在的 conversation id
Type:
  • String

(nullable) deliveredAt :Date

Source:
Inherited From:
消息送达时间
Type:
  • Date

from :String

Source:
Inherited From:
消息发送者
Type:
  • String

id :String

Source:
Inherited From:
Type:
  • String

needReceipt :Boolean

Source:
Inherited From:
Deprecated:
  • 指定是否需要送达回执请使用 Conversation#send 方法的 `options.receipt` 参数。
标记需要回执
Type:
  • Boolean

(readonly) status :Symbol

Source:
Since:
  • 3.2.0
Inherited From:
消息状态,值为 module:leancloud-realtime.MessageStatus 之一
Type:
  • Symbol

(readonly) summary :String

Source:
在客户端需要以文本形式展示该消息时显示的文案, 如 [红包] 新春快乐。 默认值为消息的 text。
Type:
  • String

text :String

Source:
Type:
  • String

timestamp :Date

Source:
Inherited From:
消息发送时间
Type:
  • Date

transient :Boolean

Source:
Inherited From:
Deprecated:
  • 指定是否作为暂态消息发送请使用 Conversation#send 方法的 `options.transient` 参数。 请不要将是否为暂态作为区分某些消息的标记,请使用富媒体消息的属性(attributes)或使用自定义消息类型。 该字段将在 v4.0 中移除。
标记暂态消息
Type:
  • Boolean

(readonly) type :Number

Source:
Type:
  • Number

updatedAt :Date

Source:
Since:
  • 3.5.0
Inherited From:
消息修改或撤回时间,可以通过比较其与消息的 timestamp 是否相等判断消息是否被修改过或撤回过。
Type:
  • Date

Methods

(protected, static) parse(json, message) → {TypedMessage}

Source:
Implements:
解析处理消息内容
为给定的 message 设置 text 与 attributes 属性,返回该 message
如果子类没有提供 message,new this()
Parameters:
Name Type Description
json Object json 格式的消息内容
message TypedMessage 子类提供的 message
Returns:
Type
TypedMessage

getAttributes() → {Object}

Source:
Returns:
Type
Object

getText() → {String}

Source:
Returns:
Type
String

setAttributes(attributes) → {TypedMessage}

Source:
Parameters:
Name Type Description
attributes Object
Returns:
self
Type
TypedMessage

setNeedReceipt(needReceipt) → {Message}

Source:
Inherited From:
Deprecated:
设置是否需要送达回执
Parameters:
Name Type Description
needReceipt Boolean
Returns:
self
Type
Message

setText(text) → {TypedMessage}

Source:
Parameters:
Name Type Description
text String
Returns:
self
Type
TypedMessage

setTransient(transient) → {Message}

Source:
Inherited From:
Deprecated:
设置是否是暂态消息
Parameters:
Name Type Description
transient Boolean
Returns:
self
Type
Message

(protected) toJSON() → {Object}

Source:
Overrides:
Implements:
将当前消息序列化为 JSON 对象
Returns:
Type
Object