Interface WxWindow

Source
Expand description

Controller for the global Window object for talking to other Windows

interface WxWindow {
    frame(
        iframe: IFrameLike,
        onRecv: WxOnRecvFn,
        options?: WxEndOptions,
    ): Promise<WxResult<WxEnd>>;
    owner(
        ownerOrigin: string,
        onRecv: WxOnRecvFn,
        options?: WxEndOptions,
    ): Promise<WxResult<WxEnd>>;
    popup(
        url: string,
        onRecv: WxOnRecvFn,
        options?: WxWindowOpenOptions,
    ): Promise<WxResult<WxEnd>>;
}

Methods§

Source§

frame(
    iframe: IFrameLike,
    onRecv: WxOnRecvFn,
    options?: WxEndOptions,
): Promise<WxResult<WxEnd>>

Create a WxEnd for messaging to an iframe

Source§

owner(
    ownerOrigin: string,
    onRecv: WxOnRecvFn,
    options?: WxEndOptions,
): Promise<WxResult<WxEnd>>

Create a WxEnd for messaging to the owner of the window. For window opened with window.open, this is the window that opened the window (i.e. the window.opener object). For iframes, this is the window that contains the iframe (i.e. the window.parent object).

Note that if this window and the owner are same-origin, the browser may put them in the same context, in which case messaging is done by directly calling the handler, since they are in the same context.

Source§

popup(
    url: string,
    onRecv: WxOnRecvFn,
    options?: WxWindowOpenOptions,
): Promise<WxResult<WxEnd>>

Open a Popup window and create a WxEnd for messaging to that window.

The returned end is tied to the window. If either the window or the end is closed, the popup window and the connection will be closed.