Skip to content

nim.sysmsg.NIMSysMsg

Zvicii edited this page Jul 11, 2022 · 7 revisions

Class: NIMSysMsg

nim/sysmsg.NIMSysMsg

Hierarchy

Table of contents

Methods

Properties

Constructors

Methods

eventNames

eventNames(): keyof NIMSysMsgEvents[]

Return an array listing the events for which the emitter has registered listeners.

Returns

keyof NIMSysMsgEvents[]

Inherited from

EventEmitter.eventNames


listeners

listeners<T>(event): (...args: ArgumentMap<NIMSysMsgEvents>[Extract<T, keyof NIMSysMsgEvents>]) => void[]

Return the listeners registered for a given event.

Type parameters

Name Type
T extends keyof NIMSysMsgEvents

Parameters

Name Type
event T

Returns

(...args: ArgumentMap<NIMSysMsgEvents>[Extract<T, keyof NIMSysMsgEvents>]) => void[]

Inherited from

EventEmitter.listeners


listenerCount

listenerCount(event): number

Return the number of listeners listening to a given event.

Parameters

Name Type
event keyof NIMSysMsgEvents

Returns

number

Inherited from

EventEmitter.listenerCount


emit

emit<T>(event, ...args): boolean

Calls each of the listeners registered for a given event.

Type parameters

Name Type
T extends keyof NIMSysMsgEvents

Parameters

Name Type
event T
...args ArgumentMap<NIMSysMsgEvents>[Extract<T, keyof NIMSysMsgEvents>]

Returns

boolean

Inherited from

EventEmitter.emit


on

on<T>(event, fn, context?): NIMSysMsg

Add a listener for a given event.

Type parameters

Name Type
T extends keyof NIMSysMsgEvents

Parameters

Name Type
event T
fn (...args: ArgumentMap<NIMSysMsgEvents>[Extract<T, keyof NIMSysMsgEvents>]) => void
context? any

Returns

NIMSysMsg

Inherited from

EventEmitter.on


addListener

addListener<T>(event, fn, context?): NIMSysMsg

Type parameters

Name Type
T extends keyof NIMSysMsgEvents

Parameters

Name Type
event T
fn (...args: ArgumentMap<NIMSysMsgEvents>[Extract<T, keyof NIMSysMsgEvents>]) => void
context? any

Returns

NIMSysMsg

Inherited from

EventEmitter.addListener


once

once<T>(event, fn, context?): NIMSysMsg

Add a one-time listener for a given event.

Type parameters

Name Type
T extends keyof NIMSysMsgEvents

Parameters

Name Type
event T
fn (...args: ArgumentMap<NIMSysMsgEvents>[Extract<T, keyof NIMSysMsgEvents>]) => void
context? any

Returns

NIMSysMsg

Inherited from

EventEmitter.once


removeListener

removeListener<T>(event, fn?, context?, once?): NIMSysMsg

Remove the listeners of a given event.

Type parameters

Name Type
T extends keyof NIMSysMsgEvents

Parameters

Name Type
event T
fn? (...args: ArgumentMap<NIMSysMsgEvents>[Extract<T, keyof NIMSysMsgEvents>]) => void
context? any
once? boolean

Returns

NIMSysMsg

Inherited from

EventEmitter.removeListener


off

off<T>(event, fn?, context?, once?): NIMSysMsg

Type parameters

Name Type
T extends keyof NIMSysMsgEvents

Parameters

Name Type
event T
fn? (...args: ArgumentMap<NIMSysMsgEvents>[Extract<T, keyof NIMSysMsgEvents>]) => void
context? any
once? boolean

Returns

NIMSysMsg

Inherited from

EventEmitter.off


removeAllListeners

removeAllListeners(event?): NIMSysMsg

Remove all listeners, or those of the specified event.

Parameters

Name Type
event? keyof NIMSysMsgEvents

Returns

NIMSysMsg

Inherited from

EventEmitter.removeAllListeners


initEventHandlers

initEventHandlers(): void

注册全局回调

Returns

void


sendCustomNotificationMsg

sendCustomNotificationMsg(msg): void

发送自定义通知消息

Parameters

Name Type
msg SysMessage

Returns

void

void 无返回值


queryMsgAsync

queryMsgAsync(limit_count, last_time, cb, jsonExtension): boolean

查询本地系统消息

Parameters

Name Type Description
limit_count number 一次查询数量,建议20
last_time number 上次查询最后一条消息的时间戳
cb QuerySysmsgCallback 查询本地系统消息的回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

boolean

boolean 检查参数如果不符合要求则返回失败


queryUnreadCount

queryUnreadCount(cb, jsonExtension): void

查询未读消息数

Note

200:成功

Parameters

Name Type Description
cb NotifySysmsgResCallback 查询未读消息数的回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

void

void 无返回值


setStatusAsync

setStatusAsync(msg_id, status, cb, jsonExtension): boolean

设置消息状态

Note

200:成功

Parameters

Name Type Description
msg_id number 消息id
status NIMSysMsgStatus 消息状态
cb NotifySingleSysmsgCallback 设置消息状态的回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

boolean

void 无返回值


readAllAsync

readAllAsync(cb, jsonExtension): void

设置全部消息为已读

Note

200:成功

Parameters

Name Type Description
cb NotifySysmsgResCallback 设置全部消息为已读的回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

void

void 无返回值


deleteAsync

deleteAsync(msg_id, cb, jsonExtension): boolean

删除消息

Note

200:成功

Parameters

Name Type Description
msg_id number 消息id
cb NotifySingleSysmsgCallback 删除消息的回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

boolean

boolean 检查参数如果不符合要求则返回失败


deleteAllAsync

deleteAllAsync(cb, jsonExtension): boolean

全部删除

Note

200:成功

Parameters

Name Type Description
cb NotifySysmsgResCallback 删除消息的回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

boolean

void 无返回值


setStatusByTypeAsync

setStatusByTypeAsync(type, status, cb, jsonExtension): boolean

按类型设置系统通知状态

Note

200:成功

Parameters

Name Type Description
type NIMSysMsgType 类型
status NIMSysMsgStatus 状态
cb NotifySysmsgResCallback 回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

boolean

void 无返回值


deleteByTypeAsync

deleteByTypeAsync(type, cb, jsonExtension): boolean

按类型删除系统通知

Note

200:成功

Parameters

Name Type Description
type NIMSysMsgType 类型
cb NotifySysmsgResCallback 回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

boolean

void 无返回值

Properties

sysmsg

sysmsg: NIMSysMsgAPI

Defined in

ts/nim/sysmsg.ts:22

Constructors

constructor

new NIMSysMsg()

Overrides

EventEmitter<NIMSysMsgEvents&gt;.constructor

Clone this wiki locally