Ipc

Ipc

new Ipc()

Source:

Methods

send(UUID, name, payload, timeout) → {Promise.<IpcEvent>}

Source:

给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)

Source:

当收到某消息时立即发送指定消息给发送方, 和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}

Source:

监听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}

Source:

单次监听webview内的消息

Parameters:
Name Type Description
UUID string

iframe的UUID, mainFrame为~,任意frame为*

name string

消息名

listener IpcListener

响应函数

Returns:

this

Type
Ipc

off(UUID, name, listeneropt) → {Ipc}

Source:

取消监听

Parameters:
Name Type Attributes Description
UUID string

iframe的UUID, mainFrame为~,任意frame为*

name string

消息名

listener IpcListener <optional>

响应函数

Returns:

this

Type
Ipc

Ipc

new Ipc()

Source:

Methods

send(UUID, name, payload, timeout) → {Promise.<IpcEvent>}

Source:

给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)

Source:

当收到某消息时立即发送指定消息给发送方, 和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}

Source:

监听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}

Source:

单次监听webview内的消息

Parameters:
Name Type Description
UUID string

iframe的UUID, mainFrame为~,任意frame为*

name string

消息名

listener IpcListener

响应函数

Returns:

this

Type
Ipc

off(UUID, name, listeneropt) → {Ipc}

Source:

取消监听

Parameters:
Name Type Attributes Description
UUID string

iframe的UUID, mainFrame为~,任意frame为*

name string

消息名

listener IpcListener <optional>

响应函数

Returns:

this

Type
Ipc