- BrowserWindow·续5
- win.setContentProtection(enable) macOS Windows
- win.setFocusable(focusable) macOS Windows
- win.setParentWindow(parent)
- win.getParentWindow()
- win.getChildWindows()
- win.setAutoHideCursor(autoHide) macOS
- win.selectPreviousTab() macOS
- win.selectNextTab() macOS
- win.mergeAllWindows() macOS
- win.moveTabToNewWindow() macOS
- win.toggleTabBar() macOS
- win.addTabbedWindow(browserWindow) macOS
- win.setVibrancy(type) macOS
- win.setTrafficLightPosition(position) macOS
- win.getTrafficLightPosition() macOS
- win.setTouchBar(touchBar) macOS 实验
- win.setBrowserView(browserView) 实验
- win.getBrowserView() 实验功能
- win.addBrowserView(browserView) 实验
- win.removeBrowserView(browserView) 实验
- win.getBrowserViews() 实验功能
BrowserWindow·续5
- forward Boolean (optional) macOS Windows - If true, forwards mouse move messages to Chromium, enabling mouse related events such as mouseleave. 仅当ignore </ 0>为 true 时才被使用。 如果 <code>ignore 为 false, 转发始终是禁用的,不管这个值是什么。
忽略窗口内的所有鼠标事件
在此窗口中发生的所有鼠标事件将被传递到此窗口下面的窗口, 但如果此窗口具有焦点, 它仍然会接收键盘事件
win.setContentProtection(enable) macOS Windows
- enable Boolean
防止窗口内容被其他应用捕获
On macOS it sets the NSWindow’s sharingType to NSWindowSharingNone. On Windows it calls SetWindowDisplayAffinity with WDA_MONITOR.
win.setFocusable(focusable) macOS Windows
- focusable Boolean
设置窗口是否可聚焦
On macOS it does not remove the focus from the window.
win.setParentWindow(parent)
- parent BrowserWindow | null
设置 parent 为当前窗口的父窗口. 为null时表示将当前窗口转为顶级窗口
win.getParentWindow()
返回 BrowserWindow - 父窗口.
win.getChildWindows()
返回 BrowserWindow[] - 首页的子窗口.
win.setAutoHideCursor(autoHide) macOS
- autoHide Boolean
设置输入时是否隐藏光标
win.selectPreviousTab() macOS
当启用本地选项卡,并且窗口中有另一个标签时,选择上一个选项卡。
win.selectNextTab() macOS
当启用本地选项卡,并且窗口中有另一个标签时,选择下一个选项卡。
win.mergeAllWindows() macOS
当启用本地选项卡并且存在多个打开窗口时,将所有窗口合并到一个带有多个选项卡的窗口中。
win.moveTabToNewWindow() macOS
如果启用了本机选项卡并且当前窗口中有多个选项卡,则将当前选项卡移动到新窗口中。
win.toggleTabBar() macOS
如果启用了本机选项卡并且当前窗口中只有一个选项卡,则切换选项卡栏是否可见。
win.addTabbedWindow(browserWindow) macOS
- browserWindow BrowserWindow
在该窗口中添加一个窗口作为选项卡,位于窗口实例的选项卡之后。
win.setVibrancy(type) macOS
- type String | null - Can be appearance-based, light, dark, titlebar, selection, menu, popover, sidebar, medium-light, ultra-dark, header, sheet, window, hud, fullscreen-ui, tooltip, content, under-window, or under-page. 更多详细信息,请查阅 macOS documentation
Adds a vibrancy effect to the browser window. Passing null or an empty string will remove the vibrancy effect on the window.
Note that appearance-based, light, dark, medium-light, and ultra-dark have been deprecated and will be removed in an upcoming version of macOS.
win.setTrafficLightPosition(position) macOS
- position Point
Set a custom position for the traffic light buttons. Can only be used with titleBarStyle set to hidden.
win.getTrafficLightPosition() macOS
Returns Point - The current position for the traffic light buttons. Can only be used with titleBarStyle set to hidden.
win.setTouchBar(touchBar) macOS 实验
- touchBar TouchBar | null
设置窗口的触摸条布局 设置为 null 或undefined将清除触摸条. 此方法只有在macOS 10.12.1+且设备支持触摸条TouchBar时可用.
注意: TouchBar API目前为实验性质,以后的Electron版本可能会更改或删除。
win.setBrowserView(browserView) 实验
- browserView BrowserView | null - Attach browserView to win. If there are other BrowserViews attached, they will be removed from this window.
win.getBrowserView() 实验功能
Returns BrowserView | null - The BrowserView attached to win. Returns null if one is not attached. Throws an error if multiple BrowserViews are attached.
win.addBrowserView(browserView) 实验
- browserView BrowserView
Replacement API for setBrowserView supporting work with multi browser views.
win.removeBrowserView(browserView) 实验
- browserView BrowserView
win.getBrowserViews() 实验功能
Returns BrowserView[] - an array of all BrowserViews that have been attached with addBrowserView or setBrowserView.
注意: BrowserView 的 API目前为实验性质,可能会更改或删除。
