Classes
Methods
send(name, payload, timeout) → {Promise.<IpcEvent>}
发送消息
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Array.<string> | 消息名, 支持合并发送payload相同的消息 |
payload |
Object | 传输数据 |
timeout |
number | 等待回复时间 |
Returns:
返回promise,等待消息回复内容
- Type
- Promise.<IpcEvent>
sendOn(trigger, name, payload) → {BoundIpc}
当收到某消息时立即发送指定消息给发送方, 和ack不同
Parameters:
Name | Type | Description |
---|---|---|
trigger |
string | 触发的消息名 |
name |
string | Array.<string> | 消息名, 支持合并发送payload相同的消息 |
payload |
Object | 传输数据 |
Returns:
this
- Type
- BoundIpc
on(name, listener) → {BoundIpc}
监听消息
Parameters:
Name | Type | Description |
---|---|---|
name |
string | 消息名 |
listener |
IpcListener | 响应函数 |
Returns:
this
- Type
- BoundIpc
once(name, listener) → {BoundIpc}
单次监听webview内的消息
Parameters:
Name | Type | Description |
---|---|---|
name |
string | 消息名 |
listener |
IpcListener | 响应函数 |
Returns:
this
- Type
- BoundIpc
off(name, listener) → {BoundIpc}
取消监听
Parameters:
Name | Type | Description |
---|---|---|
name |
string | 消息名 |
listener |
IpcListener | 响应函数 |
Returns:
this
- Type
- BoundIpc