-
Notifications
You must be signed in to change notification settings - Fork 2
nim.nos.NIMNOS
nim/nos.NIMNOS
-
EventEmitter
<NIMNOSEvents
>↳
NIMNOS
- eventNames
- listeners
- listenerCount
- emit
- on
- addListener
- once
- removeListener
- off
- removeAllListeners
- initEventHandlers
- initConfig
- fetchMedia
- stopFetchMedia
- uploadResource
- stopUploadResource
- downloadResource
- stopDownloadResource
- safeURLToOriginURL
- setSupportQuickTrans
▸ eventNames(): keyof NIMNOSEvents
[]
Return an array listing the events for which the emitter has registered listeners.
keyof NIMNOSEvents
[]
EventEmitter.eventNames
node_modules/eventemitter3/index.d.ts:15
▸ listeners<T
>(event
): (...args
: ArgumentMap
<NIMNOSEvents
>[Extract
<T
, keyof NIMNOSEvents
>]) => void
[]
Return the listeners registered for a given event.
Name | Type |
---|---|
T |
extends keyof NIMNOSEvents
|
Name | Type |
---|---|
event |
T |
(...args
: ArgumentMap
<NIMNOSEvents
>[Extract
<T
, keyof NIMNOSEvents
>]) => 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 |
keyof NIMNOSEvents
|
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 keyof NIMNOSEvents
|
Name | Type |
---|---|
event |
T |
...args |
ArgumentMap <NIMNOSEvents >[Extract <T , keyof NIMNOSEvents >] |
boolean
EventEmitter.emit
node_modules/eventemitter3/index.d.ts:32
▸ on<T
>(event
, fn
, context?
): NIMNOS
Add a listener for a given event.
Name | Type |
---|---|
T |
extends keyof NIMNOSEvents
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMNOSEvents >[Extract <T , keyof NIMNOSEvents >]) => void
|
context? |
any |
EventEmitter.on
node_modules/eventemitter3/index.d.ts:40
▸ addListener<T
>(event
, fn
, context?
): NIMNOS
Name | Type |
---|---|
T |
extends keyof NIMNOSEvents
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMNOSEvents >[Extract <T , keyof NIMNOSEvents >]) => void
|
context? |
any |
EventEmitter.addListener
node_modules/eventemitter3/index.d.ts:45
▸ once<T
>(event
, fn
, context?
): NIMNOS
Add a one-time listener for a given event.
Name | Type |
---|---|
T |
extends keyof NIMNOSEvents
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMNOSEvents >[Extract <T , keyof NIMNOSEvents >]) => void
|
context? |
any |
EventEmitter.once
node_modules/eventemitter3/index.d.ts:54
▸ removeListener<T
>(event
, fn?
, context?
, once?
): NIMNOS
Remove the listeners of a given event.
Name | Type |
---|---|
T |
extends keyof NIMNOSEvents
|
Name | Type |
---|---|
event |
T |
fn? |
(...args : ArgumentMap <NIMNOSEvents >[Extract <T , keyof NIMNOSEvents >]) => void
|
context? |
any |
once? |
boolean |
EventEmitter.removeListener
node_modules/eventemitter3/index.d.ts:63
▸ off<T
>(event
, fn?
, context?
, once?
): NIMNOS
Name | Type |
---|---|
T |
extends keyof NIMNOSEvents
|
Name | Type |
---|---|
event |
T |
fn? |
(...args : ArgumentMap <NIMNOSEvents >[Extract <T , keyof NIMNOSEvents >]) => void
|
context? |
any |
once? |
boolean |
EventEmitter.off
node_modules/eventemitter3/index.d.ts:69
▸ removeAllListeners(event?
): NIMNOS
Remove all listeners, or those of the specified event.
Name | Type |
---|---|
event? |
keyof NIMNOSEvents
|
EventEmitter.removeAllListeners
node_modules/eventemitter3/index.d.ts:79
▸ initEventHandlers(): void
注册全局回调
void
ts/nim/nos.ts:38
▸ initConfig(param
, cb
): Promise
<[InitNosResult
]>
Nos模块初始化接口,对上传资源时使用的各场景资源生命周期进行初始化,开发者最多可自定义10个场景,并指定场景资源的生命周期,并可以对缺省场景(kNIMNosDefaultTagResource、kNIMNosDefaultTagIM)进行覆盖(重新指定生命周期)
Name | Type | Description |
---|---|---|
param |
InitNosConfigParam |
初始化参数 |
cb |
null | InitNosResultCallback
|
结果回调函数 |
Promise
<[InitNosResult
]>
void 无返回值
ts/nim/nos.ts:47
▸ fetchMedia(msg
, jsonExtension
, res_cb
, prg_cb
, speed_cb
, transfer_cb
): Promise
<null
| [NIMResCode
, string
, string
, string
]>
获取资源
Note
200:成功 10206:下载暂停 408:请求过程超时 其他:参见HTTP协议或CURL错误码
Name | Type | Description |
---|---|---|
msg |
IMMessage |
消息内容 |
jsonExtension |
string |
json扩展参数 |
res_cb |
null | DownloadMediaCallback
|
下载的回调函数 |
prg_cb |
null | ProgressCallback
|
下载进度的回调函数 |
speed_cb |
null | SpeedCallback
|
下载速度的回调函数 |
transfer_cb |
null | TransferInfoCallback
|
最终下载信息的回调函数 |
Promise
<null
| [NIMResCode
, string
, string
, string
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/nos.ts:74
▸ stopFetchMedia(msg
): boolean
停止获取资源(目前仅对文件消息类型有效)
Note
错误码 10206:成功
Name | Type | Description |
---|---|---|
msg |
IMMessage |
消息内容 |
boolean
boolean 检查参数如果不符合要求则返回失败
ts/nim/nos.ts:108
▸ uploadResource(local_file
, tag
, param
, res_cb
, prg_cb
, speed_cb
, transfer_cb
): Promise
<null
| [NIMResCode
, UploadMediaResult
]>
上传资源
Note
200:成功 10200:上传暂停 408:请求过程超时 其他:参见HTTP协议或CURL错误码
Name | Type | Description |
---|---|---|
local_file |
string |
本地文件的完整路径,路径名必须是utf-8 |
tag |
string |
场景标签,主要用于确定文件的保存时间 |
param |
NOSParams |
NOS扩展上传\下载接口参数 nim_nos_download_ex" |
res_cb |
null | UploadMediaExCallback
|
扩展上传的回调函数 |
prg_cb |
null | ProgressExCallback
|
扩展上传进度的回调函数 |
speed_cb |
null | SpeedCallback
|
上传速度的回调函数 |
transfer_cb |
null | TransferInfoCallback
|
最终上传信息的回调函数 |
Promise
<null
| [NIMResCode
, UploadMediaResult
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/nos.ts:130
▸ stopUploadResource(task_id
, jsonExtension
): boolean
停止上传资源(只能用于调用了UploadResource接口的上传任务)
Note
10200:成功
Name | Type | Description |
---|---|---|
task_id |
string |
停止上传任务的ID |
jsonExtension |
string |
json扩展参数 |
boolean
boolean 检查参数如果不符合要求则返回失败
ts/nim/nos.ts:170
▸ downloadResource(nosUrl
, param
, res_cb
, prg_cb
, speed_cb
, transfer_cb
): Promise
<null
| [NIMResCode
, DownloadMediaResult
]>
下载资源
Note
200:成功 10200:上传暂停 408:请求过程超时 其他:参见HTTP协议或CURL错误码
Name | Type | Description |
---|---|---|
nosUrl |
string |
下载资源的URL |
param |
NOSParams |
NOS扩展上传\下载接口参数 |
res_cb |
null | DownloadMediaExCallback
|
扩展下载的回调函数 |
prg_cb |
null | ProgressExCallback
|
扩展下载进度的回调函数 |
speed_cb |
null | SpeedCallback
|
下载速度的回调函数 |
transfer_cb |
null | TransferInfoCallback
|
最终下载信息的回调函数 |
Promise
<null
| [NIMResCode
, DownloadMediaResult
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/nos.ts:190
▸ stopDownloadResource(task_id
, jsonExtension
): boolean
停止下载资源(只能用于调用了DownloadResourceEx接口的下载任务)
Note
10206:成功
Name | Type | Description |
---|---|---|
task_id |
string |
停止下载任务的ID |
jsonExtension |
string |
json扩展参数 |
boolean
boolean 检查参数如果不符合要求则返回失败
ts/nim/nos.ts:228
▸ safeURLToOriginURL(safe_url
, cb
, jsonExtension
): Promise
<[NIMResCode
, string
]>
根据安全链接(短链)换取源链接
Note
200:成功 414 不存在该短链或 safe_url 不是一个有效的短链
Name | Type | Description |
---|---|---|
safe_url |
string |
安全链接(短链) |
cb |
null | SafeURLToOriginURLCallback
|
结果回调 |
jsonExtension |
string |
json扩展参数 |
Promise
<[NIMResCode
, string
]>
void
ts/nim/nos.ts:243
▸ setSupportQuickTrans(quick
): void
打开或关闭文件快传开关
Name | Type | Description |
---|---|---|
quick |
boolean |
是否打开 true:打开 false:关闭 |
void
void
ts/nim/nos.ts:262
• nos: NIMNOSAPI
ts/nim/nos.ts:31
• new NIMNOS()
EventEmitter<NIMNOSEvents>.constructor
ts/nim/nos.ts:32
- 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