module:$ui/utils/messager

module:$ui/utils/messager

跨域页面消息通信类

Constructor

new (require("$ui/utils/messager"))(options)

Source:
Parameters:
Name Type Description
options object

实例化参数选项

Properties
Name Type Attributes Description
target Window <optional>

通信目标,使用桥通讯时可以不传

bridge string <optional>

目标桥页面url,如需要跨浏览器窗口传输数据,必须要设置

origin string <optional>

自身的桥,目标可以通过桥联系到自己

ready function <optional>

桥页面加载完成时回调函数

Members

target :Window|*

Source:
Properties:
Name Type Description
target Window

通信目标对象

Type:
  • Window | *

Methods

bridgeHandler(evt)

Source:

localStorage 事件处理函数

Parameters:
Name Type Description
evt object

buildBridge() → {Promise.<any>}

Source:

搭桥,创建iframe,加载桥页面

Returns:
Type
Promise.<any>

destroy()

Source:

销毁

off(typeopt, handleropt)

Source:

取消侦听

Parameters:
Name Type Attributes Description
type string <optional>

消息类型

handler function <optional>

处理函数

pass(message, origin)

Source:

桥页面传输写入localStorage

Parameters:
Name Type Description
message object
origin string

消息来源