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