当前位置: 首页 > 文档资料 > Electron 中文文档 >

类 BrowserWindowProxy

优质
小牛编辑
155浏览
2023-12-01

类: BrowserWindowProxy

操纵子浏览器窗口

进程: 渲染进程

使用 window.open 创建一个新窗口时会返回一个 BrowserWindowProxy对象,并提供一个有限功能的子窗口.

Class: BrowserWindowProxy

Manipulate the child browser window

Process: Renderer

The BrowserWindowProxy object is returned from window.open and provides limited functionality with the child window.

实例方法

BrowserWindowProxy 对象具有以下实例方法:

Instance Methods

The BrowserWindowProxy object has the following instance methods:

win.blur()

将焦点从子窗口中移除.

win.blur()

Removes focus from the child window.

win.close()

不调用卸载事件,便关闭了子窗口。

win.close()

Forcefully closes the child window without calling its unload event.

win.eval(code)

  • code String

Eval子窗口中的代码

win.eval(code)

  • code String

Evaluates the code in the child window.

win.focus()

聚焦子窗口(即窗口置顶)

win.focus()

Focuses the child window (brings the window to front).

win.print()

调用子窗口上的打印对话框

win.print()

Invokes the print dialog on the child window.

win.postMessage(message, targetOrigin)

  • message String
  • targetOrigin String

调通过指定位置或用*来代替不明位置,向子窗口发送信息

除了这些方法,子窗口还可以无特性和使用单一方法来实现 window.opener 对象.

win.postMessage(message, targetOrigin)

  • message String
  • targetOrigin String

Sends a message to the child window with the specified origin or * for no origin preference.

In addition to these methods, the child window implements window.opener object with no properties and a single method.

实例属性

BrowserWindowProxy 对象具有以下实例属性:

Instance Properties

The BrowserWindowProxy object has the following instance properties:

win.closed

在子窗口关闭后设置为 true 的 Boolean

win.closed

A Boolean that is set to true after the child window gets closed.