new FileMessage(file)
Parameters:
Name | Type | Description |
---|---|---|
file |
AV.File | LeanCloud 存储 SDK 中的 AV.File 实例,且必须是已经保存到服务端上的 File 实例 (如果是刚刚创建的,必须 save 后才能用于创建 FileMessage) |
Extends
Members
-
static, constant TYPE :Number
-
-
attributes :Object
-
- Inherited From:
-
nullable cid :String
-
消息所在的 conversation id
- Inherited From:
-
nullable deliveredAt :Date
-
消息送达时间
- Inherited From:
-
from :String
-
消息发送者
- Inherited From:
-
id :String
-
- Inherited From:
-
readonly mentioned :Boolean
-
当前用户是否在该消息中被提及
- Since:
- 4.0.0
- Inherited From:
-
mentionedAll :Boolean
-
消息是否提及了所有人
- Since:
- 4.0.0
- Inherited From:
-
mentionList :Array.<String>
-
消息提及的用户
- Since:
- 4.0.0
- Inherited From:
-
readonly status :Symbol
-
消息状态,值为 module:leancloud-realtime.MessageStatus 之一
- Since:
- 3.2.0
- Inherited From:
-
readonly summary :String
-
在客户端需要以文本形式展示该消息时显示的文案,格式为
[类型] file.name()
- Overrides:
-
text :String
-
- Inherited From:
-
timestamp :Date
-
消息发送时间
- Inherited From:
-
readonly type :Number
-
- Inherited From:
-
updatedAt :Date
-
消息修改或撤回时间,可以通过比较其与消息的 timestamp 是否相等判断消息是否被修改过或撤回过。
- Since:
- 3.5.0
- Inherited From:
Methods
-
getAttributes() → {Object}
-
Returns:
Object- Inherited From:
-
getFile() → {AV.File}
-
获得 file 对象
Returns:
AV.File -
getMentionList() → {Array.<String>}
-
获取提及用户列表
Returns:
Array.<String> - 提及用户的 id 列表- Since:
- 4.0.0
- Inherited From:
-
getText() → {String}
-
Returns:
String- Inherited From:
-
mentionAll(valueopt) → {this}
-
设置是否提及所有人
Parameters:
Name Type Attributes Default Description value
Boolean <optional>
true Returns:
this - self- Since:
- 4.0.0
- Inherited From:
-
setAttributes(attributes) → {this}
-
Parameters:
Name Type Description attributes
Object Returns:
this - self- Inherited From:
-
setMentionList(clients) → {this}
-
设置提及用户列表
Parameters:
Name Type Description clients
Array.<String> 提及用户的 id 列表 Returns:
this - self- Since:
- 4.0.0
- Inherited From:
-
setText(text) → {this}
-
Parameters:
Name Type Description text
String Returns:
this - self- Inherited From:
-
toFullJSON() → {Object}
-
返回 JSON 格式的消息,与 toJSON 不同的是,该对象包含了完整的信息,可以通过 IMClient#parseMessage 反序列化。
Returns:
Object - 返回值是一个 plain Object- Since:
- 4.0.0
- Inherited From:
-
toJSON() → {Object}
-
返回 JSON 格式的消息
Returns:
Object - 返回值是一个 plain Object- Overrides: