Members

static BinaryMessage

See:

static ChatRoom

See:

static Conversation

See:

static, constant ConversationMemberRole :String

对话成员角色枚举
Properties:
Name Type Description
OWNER String 所有者
MANAGER String 管理员
MEMBER String 成员
Since:
  • 4.0.0

static ConversationQuery

See:

static, constant debug

调试日志控制器
Example
debug.enable();  // 启用调试日志
debug.disable(); // 关闭调试日志

static Message

See:

static MessageParser

Since:
  • 5.0.0
See:

static, constant MessageQueryDirection :Number

历史消息查询方向枚举
Properties:
Name Type Description
NEW_TO_OLD Number 从后向前
OLD_TO_NEW Number 从前向后
Since:
  • 4.0.0

static, constant MessageStatus :Symbol

消息状态枚举
Properties:
Name Type Description
NONE Symbol 初始状态、未知状态
SENDING Symbol 正在发送
SENT Symbol 已发送
DELIVERED Symbol 已送达
FAILED Symbol 发送失败
Since:
  • 3.2.0

static Realtime

See:

static RecalledMessage

See:

static ServiceConversation

See:

static TemporaryConversation

See:

static TextMessage

See:

static TypedMessage

See:

inner ErrorCode :Number

Since:
  • 3.3.0

inner Event :String

SDK 可能会派发的事件枚举
Since:
  • 4.0.0

inner, constant MessagePriority :Number

消息优先级枚举
Properties:
Name Type Description
HIGH Number
NORMAL Number 普通
LOW Number
Since:
  • 3.3.0

Methods

static messageField(fields)

decorator,定义消息类的自定义字段
Parameters:
Name Type Description
fields Array.<String> 自定义字段
Example
@messageField(['foo'])
class CustomMessage extends TypedMessage {
  constructor(foo) {
    super();
    this.foo = foo;
  }
}

// 不支持 decorator 的情况下可以这样使用
class CustomMessage extends TypedMessage {
  constructor(foo) {
    super();
    this.foo = foo;
  }
  //...
}
messageField(['foo'])(CustomMessage);

static messageType(type)

decorator,定义消息类的类型常量
Parameters:
Name Type Description
type Number 自定义类型请使用正整数
Example
@messageType(1)
class CustomMessage extends TypedMessage {}

// 不支持 decorator 的情况下可以这样使用
class CustomMessage extends TypedMessage {
  //...
}
messageType(1)(CustomMessage);

static setAdapters(newAdapters)

指定 Adapters
Parameters:
Name Type Description
newAdapters Adapters Adapters 的类型请参考 @leancloud/adapter-types 中的定义

inner defineConversationProperty(prop, descriptoropt)

为 Conversation 定义一个新属性
Parameters:
Name Type Attributes Description
prop String 属性名
descriptor Object <optional>
属性的描述符,参见 getOwnPropertyDescriptor#Description - MDN,默认为该属性名对应的 Conversation 自定义属性的 getter/setter
Returns:
- void
Example
conversation.get('type');
conversation.set('type', 1);

// equals to
defineConversationProperty('type');
conversation.type;
conversation.type = 1;