-
Notifications
You must be signed in to change notification settings - Fork 2
nim.tool.NIMTool
nim/tool.NIMTool
-
EventEmitter
<NIMToolEvents
>↳
NIMTool
- eventNames
- listeners
- listenerCount
- emit
- on
- addListener
- once
- removeListener
- off
- removeAllListeners
- initEventHandlers
- getUserAppdataDir
- getSpecificAppdataDir
- getLocalAppdataDir
- getCurModuleDir
- getMd5
- getFileMd5
- getUuid
- getAudioTextAsync
- filterClientAntispam
▸ eventNames(): never
[]
Return an array listing the events for which the emitter has registered listeners.
never
[]
EventEmitter.eventNames
node_modules/eventemitter3/index.d.ts:15
▸ listeners<T
>(event
): (...args
: ArgumentMap
<NIMToolEvents
>[Extract
<T
, never
>]) => void
[]
Return the listeners registered for a given event.
Name | Type |
---|---|
T |
extends never
|
Name | Type |
---|---|
event |
T |
(...args
: ArgumentMap
<NIMToolEvents
>[Extract
<T
, never
>]) => void
[]
EventEmitter.listeners
node_modules/eventemitter3/index.d.ts:20
▸ listenerCount(event
): number
Return the number of listeners listening to a given event.
Name | Type |
---|---|
event |
never |
number
EventEmitter.listenerCount
node_modules/eventemitter3/index.d.ts:27
▸ emit<T
>(event
, ...args
): boolean
Calls each of the listeners registered for a given event.
Name | Type |
---|---|
T |
extends never
|
Name | Type |
---|---|
event |
T |
...args |
ArgumentMap <NIMToolEvents >[Extract <T , never >] |
boolean
EventEmitter.emit
node_modules/eventemitter3/index.d.ts:32
▸ on<T
>(event
, fn
, context?
): NIMTool
Add a listener for a given event.
Name | Type |
---|---|
T |
extends never
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMToolEvents >[Extract <T , never >]) => void
|
context? |
any |
EventEmitter.on
node_modules/eventemitter3/index.d.ts:40
▸ addListener<T
>(event
, fn
, context?
): NIMTool
Name | Type |
---|---|
T |
extends never
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMToolEvents >[Extract <T , never >]) => void
|
context? |
any |
EventEmitter.addListener
node_modules/eventemitter3/index.d.ts:45
▸ once<T
>(event
, fn
, context?
): NIMTool
Add a one-time listener for a given event.
Name | Type |
---|---|
T |
extends never
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMToolEvents >[Extract <T , never >]) => void
|
context? |
any |
EventEmitter.once
node_modules/eventemitter3/index.d.ts:54
▸ removeListener<T
>(event
, fn?
, context?
, once?
): NIMTool
Remove the listeners of a given event.
Name | Type |
---|---|
T |
extends never
|
Name | Type |
---|---|
event |
T |
fn? |
(...args : ArgumentMap <NIMToolEvents >[Extract <T , never >]) => void
|
context? |
any |
once? |
boolean |
EventEmitter.removeListener
node_modules/eventemitter3/index.d.ts:63
▸ off<T
>(event
, fn?
, context?
, once?
): NIMTool
Name | Type |
---|---|
T |
extends never
|
Name | Type |
---|---|
event |
T |
fn? |
(...args : ArgumentMap <NIMToolEvents >[Extract <T , never >]) => void
|
context? |
any |
once? |
boolean |
EventEmitter.off
node_modules/eventemitter3/index.d.ts:69
▸ removeAllListeners(event?
): NIMTool
Remove all listeners, or those of the specified event.
Name | Type |
---|---|
event? |
undefined |
EventEmitter.removeAllListeners
node_modules/eventemitter3/index.d.ts:79
▸ initEventHandlers(): void
注册全局回调
void
ts/nim/tool.ts:16
▸ getUserAppdataDir(appAccount
): string
获取SDK里app account对应的app data目录(各个帐号拥有独立的目录,其父目录相同)
Name | Type |
---|---|
appAccount |
string |
string
std::string 返回的目录路径(UTF8)
ts/nim/tool.ts:24
▸ getSpecificAppdataDir(appAccount
, appdataType
): string
获取SDK里app account对应的具体类型的app data目录(如图片消息文件存放目录,语音消息文件存放目录等),需要调用nim_free_buf(void *data)释放内存
Name | Type |
---|---|
appAccount |
string |
appdataType |
NIMAppDataType |
string
std::string返回的目录路径(目录可能未生成,需要app自行判断是否已生成)
ts/nim/tool.ts:33
▸ getLocalAppdataDir(): string
获取本地存储路径
string
std::string 返回的目录路径(UTF8)
ts/nim/tool.ts:40
▸ getCurModuleDir(): string
获取安装目录(SDK DLL所在的当前目录)
string
std::string 返回的目录路径(UTF8)
ts/nim/tool.ts:47
▸ getMd5(input
): string
计算md5
Name | Type | Description |
---|---|---|
input |
string |
需要计算md5的内容 |
string
std::string 返回的md5
ts/nim/tool.ts:55
▸ getFileMd5(filePath
): string
计算文件的md5
Name | Type |
---|---|
filePath |
string |
string
std::string 返回的md5
ts/nim/tool.ts:63
▸ getUuid(): string
生成UUID
string
std::string 返回的UUID
ts/nim/tool.ts:70
▸ getAudioTextAsync(audioInfo
, cb
, jsonExtension
): Promise
<null
| [NIMResCode
, string
]>
语音转文字
Note
200:成功 403:没有权限 414:参数错误 500:未知错误 6101:语音转码解析失败 6102:语音时长过长(超过60s 6103:服务不可用 6104:audioUrl不合法
Name | Type | Description |
---|---|---|
audioInfo |
AudioInfo |
- |
cb |
null | GetAudioTextCallback
|
语音转文字回调 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<null
| [NIMResCode
, string
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/tool.ts:91
▸ filterClientAntispam(text
, replaceString
, libName
, cb
): Promise
<[boolean
, NIMResCode
, string
]>
客户端本地反垃圾
Note
回调函数ret 1:敏感词已被替换; 2:含有敏感词不允许发送; 3:需要将内容设置在消息结构的反垃圾字段里,由服务器过滤
Name | Type | Description |
---|---|---|
text |
string |
文本内容,UTF-8 |
replaceString |
string |
- |
libName |
string |
- |
cb |
null | FilterClientAntispamCallback
|
- |
Promise
<[boolean
, NIMResCode
, string
]>
ts/nim/tool.ts:124
• tool: NIMToolAPI
ts/nim/tool.ts:9
• new NIMTool()
EventEmitter<NIMToolEvents>.constructor
ts/nim/tool.ts:10
- chatroom/chatroom
- chatroom_def/chatroom_def
- nim/client
- nim/data_sync
- nim/friend
- nim/global
- nim/msglog
- nim/nos
- nim/online_session
- nim/pass_through_proxy
- nim/plugin
- nim/session
- nim/subscribe_event
- nim/super_team
- nim/sysmsg
- nim/talk
- nim/talkex
- nim/team
- nim/tool
- nim/user
- nim_def/client_def
- nim_def/data_sync_def
- nim_def/doc_trans_def
- nim_def/friend_def
- nim_def/global_def
- nim_def/msglog_def
- nim_def/nos_def
- nim_def/online_session_def
- nim_def/pass_through_proxy_def
- nim_def/plugin_def
- nim_def/session_def
- nim_def/subscribe_event_def
- nim_def/super_team_def
- nim_def/sysmsg_def
- nim_def/talk_def
- nim_def/talkex_def
- nim_def/team_def
- nim_def/tool_def
- nim_def/user_def
- node-nim
- qchat/attachment
- qchat/channel
- qchat/channel_category
- qchat/instance
- qchat/message
- qchat/role
- qchat/server
- qchat/system_notification
- qchat_def/attachment_def
- qchat_def/channel_def
- qchat_def/instance_def
- qchat_def/message_def
- qchat_def/public_def
- qchat_def/role_def
- qchat_def/server_def
- qchat_def/system_notification_def