Skip to content

ElectronWindow

Extends

  • BrowserWindow

Properties

_browserViews

_browserViews: unknown


_events

_events: unknown


_eventsCount

_eventsCount: unknown


accessibleTitle

accessibleTitle: string

A string property that defines an alternative title provided only to accessibility tools such as screen readers. This string is not directly visible to users.

Inherited from

BrowserWindow.accessibleTitle


autoHideMenuBar

autoHideMenuBar: boolean

A boolean property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single Alt key.

If the menu bar is already visible, setting this property to true won’t hide it immediately.

Inherited from

BrowserWindow.autoHideMenuBar


closable

closable: boolean

A boolean property that determines whether the window can be manually closed by user.

On Linux the setter is a no-op, although the getter returns true.

Platform

darwin,win32

Inherited from

BrowserWindow.closable


contentView

contentView: View

A View property for the content view of the window.

Inherited from

BrowserWindow.contentView


devToolsWebContents

devToolsWebContents: unknown


documentEdited

documentEdited: boolean

A boolean property that specifies whether the window’s document has been edited.

The icon in title bar will become gray when set to true.

Platform

darwin

Inherited from

BrowserWindow.documentEdited


excludedFromShownWindowsMenu

excludedFromShownWindowsMenu: boolean

A boolean property that determines whether the window is excluded from the application’s Windows menu. false by default.

Platform

darwin

Inherited from

BrowserWindow.excludedFromShownWindowsMenu


focusable

focusable: boolean

A boolean property that determines whether the window is focusable.

Platform

win32,darwin

Inherited from

BrowserWindow.focusable


fullScreen

fullScreen: boolean

A boolean property that determines whether the window is in fullscreen mode.

Inherited from

BrowserWindow.fullScreen


fullScreenable

fullScreenable: boolean

A boolean property that determines whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.

Inherited from

BrowserWindow.fullScreenable


id

readonly id: number

A Integer property representing the unique ID of the window. Each ID is unique among all BrowserWindow instances of the entire Electron application.

Inherited from

BrowserWindow.id


kiosk

kiosk: boolean

A boolean property that determines whether the window is in kiosk mode.

Inherited from

BrowserWindow.kiosk


maximizable

maximizable: boolean

A boolean property that determines whether the window can be manually maximized by user.

On Linux the setter is a no-op, although the getter returns true.

Platform

darwin,win32

Inherited from

BrowserWindow.maximizable


menuBarVisible: boolean

A boolean property that determines whether the menu bar should be visible.

Note: If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single Alt key.

Platform

win32,linux

Inherited from

BrowserWindow.menuBarVisible


minimizable

minimizable: boolean

A boolean property that determines whether the window can be manually minimized by user.

On Linux the setter is a no-op, although the getter returns true.

Platform

darwin,win32

Inherited from

BrowserWindow.minimizable


movable

movable: boolean

A boolean property that determines Whether the window can be moved by user.

On Linux the setter is a no-op, although the getter returns true.

Platform

darwin,win32

Inherited from

BrowserWindow.movable


representedFilename

representedFilename: string

A string property that determines the pathname of the file the window represents, and the icon of the file will show in window’s title bar.

Platform

darwin

Inherited from

BrowserWindow.representedFilename


resizable

resizable: boolean

A boolean property that determines whether the window can be manually resized by user.

Inherited from

BrowserWindow.resizable


shadow

shadow: boolean

A boolean property that determines whether the window has a shadow.

Inherited from

BrowserWindow.shadow


simpleFullScreen

simpleFullScreen: boolean

A boolean property that determines whether the window is in simple (pre-Lion) fullscreen mode.

Inherited from

BrowserWindow.simpleFullScreen


tabbingIdentifier?

readonly optional tabbingIdentifier: string

A string (optional) property that is equal to the tabbingIdentifier passed to the BrowserWindow constructor or undefined if none was set.

Platform

darwin

Inherited from

BrowserWindow.tabbingIdentifier


title

title: string

A string property that determines the title of the native window.

Note: The title of the web page can be different from the title of the native window.

Inherited from

BrowserWindow.title


visibleOnAllWorkspaces

visibleOnAllWorkspaces: boolean

A boolean property that determines whether the window is visible on all workspaces.

Note: Always returns false on Windows.

Platform

darwin,linux

Inherited from

BrowserWindow.visibleOnAllWorkspaces


webContents

readonly webContents: WebContents

A WebContents object this window owns. All web page related events and operations will be done via it.

See the webContents documentation for its methods and events.

Inherited from

BrowserWindow.webContents

Methods

addBrowserView()

addBrowserView(browserView): void

Replacement API for setBrowserView supporting work with multi browser views.

Note The BrowserView class is deprecated, and replaced by the new WebContentsView class.

Parameters

browserView: BrowserView

Returns

void

Inherited from

BrowserWindow.addBrowserView


addListener()

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "always-on-top-changed"

listener

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "always-on-top-changed"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "enter-html-full-screen"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "focus"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "focus"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "hide"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "hide"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "leave-html-full-screen"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "maximize"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "maximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "minimize"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "minimize"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "move"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "move"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "page-title-updated"

listener

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "ready-to-show"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "responsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "unresponsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener

addListener(event, listener)

addListener(event, listener): this

Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.addListener


addTabbedWindow()

addTabbedWindow(browserWindow): void

Adds a window as a tab on this window, after the tab for the window instance.

Parameters

browserWindow: BrowserWindow

Returns

void

Platform

darwin

Inherited from

BrowserWindow.addTabbedWindow


blur()

blur(): void

Removes focus from the window.

Returns

void

Inherited from

BrowserWindow.blur


blurWebView()

blurWebView(): void

Returns

void

Inherited from

BrowserWindow.blurWebView


capturePage()

capturePage(rect?, opts?): Promise<NativeImage>

Resolves with a NativeImage

Captures a snapshot of the page within rect. Omitting rect will capture the whole visible page. If the page is not visible, rect may be empty. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that stayHidden is set to true.

Parameters

rect?: Rectangle

opts?: Opts

Returns

Promise<NativeImage>

Inherited from

BrowserWindow.capturePage


center()

center(): void

Moves window to the center of the screen.

Returns

void

Inherited from

BrowserWindow.center


close()

close(): void

Try to close the window. This has the same effect as a user manually clicking the close button of the window. The web page may cancel the close though. See the close event.

Returns

void

Inherited from

BrowserWindow.close


closeFilePreview()

closeFilePreview(): void

Closes the currently open Quick Look panel.

Returns

void

Platform

darwin

Inherited from

BrowserWindow.closeFilePreview


destroy()

destroy(): void

Force closing the window, the unload and beforeunload event won’t be emitted for the web page, and close event will also not be emitted for this window, but it guarantees the closed event will be emitted.

Returns

void

Inherited from

BrowserWindow.destroy


emit()

emit(eventName, …args): boolean

Synchronously calls each of the listeners registered for the event namedeventName, in the order they were registered, passing the supplied arguments to each.

Returns true if the event had listeners, false otherwise.

const EventEmitter = require('events');
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener

Parameters

eventName: string | symbol

• …args: any[]

Returns

boolean

Since

v0.1.26

Inherited from

BrowserWindow.emit


eventNames()

eventNames(): (string | symbol)[]

Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

const EventEmitter = require('events');
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]

Returns

(string | symbol)[]

Since

v6.0.0

Inherited from

BrowserWindow.eventNames


flashFrame()

flashFrame(flag): void

Starts or stops flashing the window to attract user’s attention.

Parameters

flag: boolean

Returns

void

Inherited from

BrowserWindow.flashFrame


focus()

focus(): void

Focuses on the window.

Returns

void

Inherited from

BrowserWindow.focus


focusOnWebView()

focusOnWebView(): void

Returns

void

Inherited from

BrowserWindow.focusOnWebView


getBackgroundColor()

getBackgroundColor(): string

Gets the background color of the window in Hex (#RRGGBB) format.

See Setting backgroundColor.

Note: The alpha value is not returned alongside the red, green, and blue values.

Returns

string

Inherited from

BrowserWindow.getBackgroundColor


getBounds()

getBounds(): Rectangle

The bounds of the window as Object.

Note: On macOS, the y-coordinate value returned will be at minimum the Tray height. For example, calling win.setBounds({ x: 25, y: 20, width: 800, height: 600 }) with a tray height of 38 means that win.getBounds() will return { x: 25, y: 38, width: 800, height: 600 }.

Returns

Rectangle

Inherited from

BrowserWindow.getBounds


getBrowserView()

getBrowserView(): null | BrowserView

The BrowserView attached to win. Returns null if one is not attached. Throws an error if multiple BrowserViews are attached.

Note The BrowserView class is deprecated, and replaced by the new WebContentsView class.

Returns

null | BrowserView

Inherited from

BrowserWindow.getBrowserView


getBrowserViews()

getBrowserViews(): BrowserView[]

a sorted by z-index array of all BrowserViews that have been attached with addBrowserView or setBrowserView. The top-most BrowserView is the last element of the array.

Note The BrowserView class is deprecated, and replaced by the new WebContentsView class.

Returns

BrowserView[]

Inherited from

BrowserWindow.getBrowserViews


getChildWindows()

getChildWindows(): BrowserWindow[]

All child windows.

Returns

BrowserWindow[]

Inherited from

BrowserWindow.getChildWindows


getContentBounds()

getContentBounds(): Rectangle

The bounds of the window’s client area as Object.

Returns

Rectangle

Inherited from

BrowserWindow.getContentBounds


getContentSize()

getContentSize(): number[]

Contains the window’s client area’s width and height.

Returns

number[]

Inherited from

BrowserWindow.getContentSize


getContentView()

getContentView(): void

Returns View - The content view of the window.

Returns

void

Inherited from

BrowserWindow.getContentView


getMaximumSize()

getMaximumSize(): number[]

Contains the window’s maximum width and height.

Returns

number[]

Inherited from

BrowserWindow.getMaximumSize


getMaxListeners()

getMaxListeners(): number

Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to defaultMaxListeners.

Returns

number

Since

v1.0.0

Inherited from

BrowserWindow.getMaxListeners


getMediaSourceId()

getMediaSourceId(): string

Window id in the format of DesktopCapturerSource’s id. For example “window:1324:0”.

More precisely the format is window:id:other_id where id is HWND on Windows, CGWindowID (uint64_t) on macOS and Window (unsigned long) on Linux. other_id is used to identify web contents (tabs) so within the same top level window.

Returns

string

Inherited from

BrowserWindow.getMediaSourceId


getMinimumSize()

getMinimumSize(): number[]

Contains the window’s minimum width and height.

Returns

number[]

Inherited from

BrowserWindow.getMinimumSize


getNativeWindowHandle()

getNativeWindowHandle(): Buffer

The platform-specific handle of the window.

The native type of the handle is HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.

Returns

Buffer

Inherited from

BrowserWindow.getNativeWindowHandle


getNormalBounds()

getNormalBounds(): Rectangle

Contains the window bounds of the normal state

Note: whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same Rectangle.

Returns

Rectangle

Inherited from

BrowserWindow.getNormalBounds


getOpacity()

getOpacity(): number

between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns 1.

Returns

number

Inherited from

BrowserWindow.getOpacity


getParentWindow()

getParentWindow(): null | BrowserWindow

The parent window or null if there is no parent.

Returns

null | BrowserWindow

Inherited from

BrowserWindow.getParentWindow


getPosition()

getPosition(): number[]

Contains the window’s current position.

Returns

number[]

Inherited from

BrowserWindow.getPosition


getRepresentedFilename()

getRepresentedFilename(): string

The pathname of the file the window represents.

Returns

string

Platform

darwin

Inherited from

BrowserWindow.getRepresentedFilename


getSize()

getSize(): number[]

Contains the window’s width and height.

Returns

number[]

Inherited from

BrowserWindow.getSize


getTitle()

getTitle(): string

The title of the native window.

Note: The title of the web page can be different from the title of the native window.

Returns

string

Inherited from

BrowserWindow.getTitle


getWindowButtonPosition()

getWindowButtonPosition(): null | Point

The custom position for the traffic light buttons in frameless window, null will be returned when there is no custom position.

Returns

null | Point

Platform

darwin

Inherited from

BrowserWindow.getWindowButtonPosition


hasShadow()

hasShadow(): boolean

Whether the window has a shadow.

Returns

boolean

Inherited from

BrowserWindow.hasShadow


hide()

hide(): void

Hides the window.

Returns

void

Inherited from

BrowserWindow.hide


hookWindowMessage()

hookWindowMessage(message, callback): void

Hooks a windows message. The callback is called when the message is received in the WndProc.

Parameters

message: number

callback

Returns

void

Platform

win32

Inherited from

BrowserWindow.hookWindowMessage


invalidateShadow()

invalidateShadow(): void

Invalidates the window shadow so that it is recomputed based on the current window shape.

BrowserWindows that are transparent can sometimes leave behind visual artifacts on macOS. This method can be used to clear these artifacts when, for example, performing an animation.

Returns

void

Platform

darwin

Inherited from

BrowserWindow.invalidateShadow


isAlwaysOnTop()

isAlwaysOnTop(): boolean

Whether the window is always on top of other windows.

Returns

boolean

Inherited from

BrowserWindow.isAlwaysOnTop


isClosable()

isClosable(): boolean

Whether the window can be manually closed by user.

On Linux always returns true.

Returns

boolean

Platform

darwin,win32

Inherited from

BrowserWindow.isClosable


isDestroyed()

isDestroyed(): boolean

Whether the window is destroyed.

Returns

boolean

Inherited from

BrowserWindow.isDestroyed


isDocumentEdited()

isDocumentEdited(): boolean

Whether the window’s document has been edited.

Returns

boolean

Platform

darwin

Inherited from

BrowserWindow.isDocumentEdited


isEnabled()

isEnabled(): boolean

whether the window is enabled.

Returns

boolean

Inherited from

BrowserWindow.isEnabled


isFocusable()

isFocusable(): boolean

Whether the window can be focused.

Returns

boolean

Platform

darwin,win32

Inherited from

BrowserWindow.isFocusable


isFocused()

isFocused(): boolean

Whether the window is focused.

Returns

boolean

Inherited from

BrowserWindow.isFocused


isFullScreen()

isFullScreen(): boolean

Whether the window is in fullscreen mode.

Note: On macOS, fullscreen transitions take place asynchronously. When querying for a BrowserWindow’s fullscreen status, you should ensure that either the ‘enter-full-screen’ or ‘leave-full-screen’ events have been emitted.

Returns

boolean

Inherited from

BrowserWindow.isFullScreen


isFullScreenable()

isFullScreenable(): boolean

Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.

Returns

boolean

Inherited from

BrowserWindow.isFullScreenable


isHiddenInMissionControl()

isHiddenInMissionControl(): boolean

Whether the window will be hidden when the user toggles into mission control.

Returns

boolean

Platform

darwin

Inherited from

BrowserWindow.isHiddenInMissionControl


isKiosk()

isKiosk(): boolean

Whether the window is in kiosk mode.

Returns

boolean

Inherited from

BrowserWindow.isKiosk


isMaximizable()

isMaximizable(): boolean

Whether the window can be manually maximized by user.

On Linux always returns true.

Returns

boolean

Platform

darwin,win32

Inherited from

BrowserWindow.isMaximizable


isMaximized()

isMaximized(): boolean

Whether the window is maximized.

Returns

boolean

Inherited from

BrowserWindow.isMaximized


isMenuBarAutoHide()

isMenuBarAutoHide(): boolean

Whether menu bar automatically hides itself.

Returns

boolean

Platform

win32,linux

Inherited from

BrowserWindow.isMenuBarAutoHide


isMenuBarVisible()

isMenuBarVisible(): boolean

Whether the menu bar is visible.

Returns

boolean

Platform

win32,linux

Inherited from

BrowserWindow.isMenuBarVisible


isMinimizable()

isMinimizable(): boolean

Whether the window can be manually minimized by the user.

On Linux always returns true.

Returns

boolean

Platform

darwin,win32

Inherited from

BrowserWindow.isMinimizable


isMinimized()

isMinimized(): boolean

Whether the window is minimized.

Returns

boolean

Inherited from

BrowserWindow.isMinimized


isModal()

isModal(): boolean

Whether current window is a modal window.

Returns

boolean

Inherited from

BrowserWindow.isModal


isMovable()

isMovable(): boolean

Whether the window can be moved by user.

On Linux always returns true.

Returns

boolean

Platform

darwin,win32

Inherited from

BrowserWindow.isMovable


isNormal()

isNormal(): boolean

Whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).

Returns

boolean

Inherited from

BrowserWindow.isNormal


isResizable()

isResizable(): boolean

Whether the window can be manually resized by the user.

Returns

boolean

Inherited from

BrowserWindow.isResizable


isSimpleFullScreen()

isSimpleFullScreen(): boolean

Whether the window is in simple (pre-Lion) fullscreen mode.

Returns

boolean

Platform

darwin

Inherited from

BrowserWindow.isSimpleFullScreen


isTabletMode()

isTabletMode(): boolean

Whether the window is in Windows 10 tablet mode.

Since Windows 10 users can use their PC as tablet, under this mode apps can choose to optimize their UI for tablets, such as enlarging the titlebar and hiding titlebar buttons.

This API returns whether the window is in tablet mode, and the resize event can be be used to listen to changes to tablet mode.

Returns

boolean

Platform

win32

Inherited from

BrowserWindow.isTabletMode


isVisible()

isVisible(): boolean

Whether the window is visible to the user in the foreground of the app.

Returns

boolean

Inherited from

BrowserWindow.isVisible


isVisibleOnAllWorkspaces()

isVisibleOnAllWorkspaces(): boolean

Whether the window is visible on all workspaces.

Note: This API always returns false on Windows.

Returns

boolean

Platform

darwin,linux

Inherited from

BrowserWindow.isVisibleOnAllWorkspaces


isWindowMessageHooked()

isWindowMessageHooked(message): boolean

true or false depending on whether the message is hooked.

Parameters

message: number

Returns

boolean

Platform

win32

Inherited from

BrowserWindow.isWindowMessageHooked


listenerCount()

listenerCount(eventName): number

Returns the number of listeners listening to the event named eventName.

Parameters

eventName: string | symbol

The name of the event being listened for

Returns

number

Since

v3.2.0

Inherited from

BrowserWindow.listenerCount


listeners()

listeners(eventName): Function[]

Returns a copy of the array of listeners for the event named eventName.

server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]

Parameters

eventName: string | symbol

Returns

Function[]

Since

v0.1.26

Inherited from

BrowserWindow.listeners


loadFile()

loadFile(filePath, options?): Promise<void>

the promise will resolve when the page has finished loading (see did-finish-load), and rejects if the page fails to load (see did-fail-load).

Same as webContents.loadFile, filePath should be a path to an HTML file relative to the root of your application. See the webContents docs for more information.

Parameters

filePath: string

options?: LoadFileOptions

Returns

Promise<void>

Inherited from

BrowserWindow.loadFile


loadURL()

loadURL(url, options?): Promise<void>

the promise will resolve when the page has finished loading (see did-finish-load), and rejects if the page fails to load (see did-fail-load).

Same as webContents.loadURL(url[, options]).

The url can be a remote address (e.g. http://) or a path to a local HTML file using the file:// protocol.

To ensure that file URLs are properly formatted, it is recommended to use Node’s url.format method:

You can load a URL using a POST request with URL-encoded data by doing the following:

Parameters

url: string

options?: LoadURLOptions

Returns

Promise<void>

Inherited from

BrowserWindow.loadURL


maximize()

maximize(): void

Maximizes the window. This will also show (but not focus) the window if it isn’t being displayed already.

Returns

void

Inherited from

BrowserWindow.maximize


mergeAllWindows()

mergeAllWindows(): void

Merges all windows into one window with multiple tabs when native tabs are enabled and there is more than one open window.

Returns

void

Platform

darwin

Inherited from

BrowserWindow.mergeAllWindows


minimize()

minimize(): void

Minimizes the window. On some platforms the minimized window will be shown in the Dock.

Returns

void

Inherited from

BrowserWindow.minimize


moveAbove()

moveAbove(mediaSourceId): void

Moves window above the source window in the sense of z-order. If the mediaSourceId is not of type window or if the window does not exist then this method throws an error.

Parameters

mediaSourceId: string

Returns

void

Inherited from

BrowserWindow.moveAbove


moveTabToNewWindow()

moveTabToNewWindow(): void

Moves the current tab into a new window if native tabs are enabled and there is more than one tab in the current window.

Returns

void

Platform

darwin

Inherited from

BrowserWindow.moveTabToNewWindow


moveTop()

moveTop(): void

Moves window to top(z-order) regardless of focus

Returns

void

Inherited from

BrowserWindow.moveTop


off()

off(event, listener)

off(event, listener): this

Parameters

event: "always-on-top-changed"

listener

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "always-on-top-changed"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "enter-html-full-screen"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "focus"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "focus"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "hide"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "hide"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "leave-html-full-screen"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "maximize"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "maximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "minimize"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "minimize"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "move"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "move"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "page-title-updated"

listener

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "ready-to-show"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "responsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "unresponsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off

off(event, listener)

off(event, listener): this

Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.off


on()

on(event, listener)

on(event, listener): this

Emitted when the window is set or unset to show always on top of other windows.

Parameters

event: "always-on-top-changed"

listener

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is set or unset to show always on top of other windows.

Parameters

event: "always-on-top-changed"

listener

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when an App Command is invoked. These are typically related to keyboard media keys or browser commands, as well as the “Back” button built into some mice on Windows.

Commands are lowercased, underscores are replaced with hyphens, and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is emitted as browser-backward.

The following app commands are explicitly supported on Linux:

  • browser-backward
  • browser-forward
Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when an App Command is invoked. These are typically related to keyboard media keys or browser commands, as well as the “Back” button built into some mice on Windows.

Commands are lowercased, underscores are replaced with hyphens, and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is emitted as browser-backward.

The following app commands are explicitly supported on Linux:

  • browser-backward
  • browser-forward
Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window loses focus.

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window loses focus.

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is going to be closed. It’s emitted before the beforeunload and unload event of the DOM. Calling event.preventDefault() will cancel the close.

Usually you would want to use the beforeunload handler to decide whether the window should be closed, which will also be called when the window is reloaded. In Electron, returning any value other than undefined would cancel the close. For example:

Note: There is a subtle difference between the behaviors of window.onbeforeunload = handler and window.addEventListener('beforeunload', handler). It is recommended to always set the event.returnValue explicitly, instead of only returning a value, as the former works more consistently within Electron.

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is going to be closed. It’s emitted before the beforeunload and unload event of the DOM. Calling event.preventDefault() will cancel the close.

Usually you would want to use the beforeunload handler to decide whether the window should be closed, which will also be called when the window is reloaded. In Electron, returning any value other than undefined would cancel the close. For example:

Note: There is a subtle difference between the behaviors of window.onbeforeunload = handler and window.addEventListener('beforeunload', handler). It is recommended to always set the event.returnValue explicitly, instead of only returning a value, as the former works more consistently within Electron.

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is closed. After you have received this event you should remove the reference to the window and avoid using it any more.

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is closed. After you have received this event you should remove the reference to the window and avoid using it any more.

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window enters a full-screen state.

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window enters a full-screen state.

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window enters a full-screen state triggered by HTML API.

Parameters

event: "enter-html-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window gains focus.

Parameters

event: "focus"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window gains focus.

Parameters

event: "focus"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is hidden.

Parameters

event: "hide"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is hidden.

Parameters

event: "hide"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window leaves a full-screen state.

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window leaves a full-screen state.

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window leaves a full-screen state triggered by HTML API.

Parameters

event: "leave-html-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when window is maximized.

Parameters

event: "maximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when window is maximized.

Parameters

event: "maximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is minimized.

Parameters

event: "minimize"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is minimized.

Parameters

event: "minimize"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is being moved to a new position.

Parameters

event: "move"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is being moved to a new position.

Parameters

event: "move"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted once when the window is moved to a new position.

Note: On macOS this event is an alias of move.

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted once when the window is moved to a new position.

Note: On macOS this event is an alias of move.

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the native new tab button is clicked.

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the native new tab button is clicked.

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the document changed its title, calling event.preventDefault() will prevent the native window’s title from changing. explicitSet is false when title is synthesized from file URL.

Parameters

event: "page-title-updated"

listener

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the web page has been rendered (while not being shown) and window can be displayed without a visual flash.

Please note that using this event implies that the renderer will be considered “visible” and paint even though show is false. This event will never fire if you use paintWhenInitiallyHidden: false

Parameters

event: "ready-to-show"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted after the window has been resized.

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted after the window has been resized.

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted once when the window has finished being resized.

This is usually emitted when the window has been resized manually. On macOS, resizing the window with setBounds/setSize and setting the animate parameter to true will also emit this event once resizing has finished.

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted once when the window has finished being resized.

This is usually emitted when the window has been resized manually. On macOS, resizing the window with setBounds/setSize and setting the animate parameter to true will also emit this event once resizing has finished.

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the unresponsive web page becomes responsive again.

Parameters

event: "responsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is restored from a minimized state.

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is restored from a minimized state.

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted on trackpad rotation gesture. Continually emitted until rotation gesture is ended. The rotation value on each emission is the angle in degrees rotated since the last emission. The last emitted event upon a rotation gesture will always be of value 0. Counter-clockwise rotation values are positive, while clockwise ones are negative.

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted on trackpad rotation gesture. Continually emitted until rotation gesture is ended. The rotation value on each emission is the angle in degrees rotated since the last emission. The last emitted event upon a rotation gesture will always be of value 0. Counter-clockwise rotation values are positive, while clockwise ones are negative.

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when window session is going to end due to force shutdown or machine restart or session log off.

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when window session is going to end due to force shutdown or machine restart or session log off.

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window opens a sheet.

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window opens a sheet.

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window has closed a sheet.

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window has closed a sheet.

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is shown.

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window is shown.

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted on 3-finger swipe. Possible directions are up, right, down, left.

The method underlying this event is built to handle older macOS-style trackpad swiping, where the content on the screen doesn’t move with the swipe. Most macOS trackpads are not configured to allow this kind of swiping anymore, so in order for it to emit properly the ‘Swipe between pages’ preference in System Preferences > Trackpad > More Gestures must be set to ‘Swipe with two or three fingers’.

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted on 3-finger swipe. Possible directions are up, right, down, left.

The method underlying this event is built to handle older macOS-style trackpad swiping, where the content on the screen doesn’t move with the swipe. Most macOS trackpads are not configured to allow this kind of swiping anymore, so in order for it to emit properly the ‘Swipe between pages’ preference in System Preferences > Trackpad > More Gestures must be set to ‘Swipe with two or three fingers’.

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the system context menu is triggered on the window, this is normally only triggered when the user right clicks on the non-client area of your window. This is the window titlebar or any area you have declared as -webkit-app-region: drag in a frameless window.

Calling event.preventDefault() will prevent the menu from being displayed.

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the system context menu is triggered on the window, this is normally only triggered when the user right clicks on the non-client area of your window. This is the window titlebar or any area you have declared as -webkit-app-region: drag in a frameless window.

Calling event.preventDefault() will prevent the menu from being displayed.

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window exits from a maximized state.

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the window exits from a maximized state.

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted when the web page becomes unresponsive.

Parameters

event: "unresponsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted before the window is moved. On Windows, calling event.preventDefault() will prevent the window from being moved.

Note that this is only emitted when the window is being moved manually. Moving the window with setPosition/setBounds/center will not emit this event.

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted before the window is moved. On Windows, calling event.preventDefault() will prevent the window from being moved.

Note that this is only emitted when the window is being moved manually. Moving the window with setPosition/setBounds/center will not emit this event.

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted before the window is resized. Calling event.preventDefault() will prevent the window from being resized.

Note that this is only emitted when the window is being resized manually. Resizing the window with setBounds/setSize will not emit this event.

The possible values and behaviors of the edge option are platform dependent. Possible values are:

  • On Windows, possible values are bottom, top, left, right, top-left, top-right, bottom-left, bottom-right.
  • On macOS, possible values are bottom and right.
    • The value bottom is used to denote vertical resizing.
    • The value right is used to denote horizontal resizing.
Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.on

on(event, listener)

on(event, listener): this

Emitted before the window is resized. Calling event.preventDefault() will prevent the window from being resized.

Note that this is only emitted when the window is being resized manually. Resizing the window with setBounds/setSize will not emit this event.

The possible values and behaviors of the edge option are platform dependent. Possible values are:

  • On Windows, possible values are bottom, top, left, right, top-left, top-right, bottom-left, bottom-right.
  • On macOS, possible values are bottom and right.
    • The value bottom is used to denote vertical resizing.
    • The value right is used to denote horizontal resizing.
Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.on


once()

once(event, listener)

once(event, listener): this

Parameters

event: "always-on-top-changed"

listener

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "always-on-top-changed"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "enter-html-full-screen"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "focus"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "focus"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "hide"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "hide"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "leave-html-full-screen"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "maximize"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "maximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "minimize"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "minimize"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "move"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "move"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "page-title-updated"

listener

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "ready-to-show"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "responsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "unresponsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once

once(event, listener)

once(event, listener): this

Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.once


prependListener()

prependListener(eventName, listener): this

Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

server.prependListener('connection', (stream) => {
console.log('someone connected!');
});

Returns a reference to the EventEmitter, so that calls can be chained.

Parameters

eventName: string | symbol

The name of the event.

listener

The callback function

Returns

this

Since

v6.0.0

Inherited from

BrowserWindow.prependListener


prependOnceListener()

prependOnceListener(eventName, listener): this

Adds a one-timelistener function for the event named eventName to the_beginning_ of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});

Returns a reference to the EventEmitter, so that calls can be chained.

Parameters

eventName: string | symbol

The name of the event.

listener

The callback function

Returns

this

Since

v6.0.0

Inherited from

BrowserWindow.prependOnceListener


previewFile()

previewFile(path, displayName?): void

Uses Quick Look to preview a file at a given path.

Parameters

path: string

displayName?: string

Returns

void

Platform

darwin

Inherited from

BrowserWindow.previewFile


rawListeners()

rawListeners(eventName): Function[]

Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');

Parameters

eventName: string | symbol

Returns

Function[]

Since

v9.4.0

Inherited from

BrowserWindow.rawListeners


reload()

reload(): void

Same as webContents.reload.

Returns

void

Inherited from

BrowserWindow.reload


removeAllListeners()

removeAllListeners(event?): this

Removes all listeners, or those of the specified eventName.

It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

Returns a reference to the EventEmitter, so that calls can be chained.

Parameters

event?: string | symbol

Returns

this

Since

v0.1.26

Inherited from

BrowserWindow.removeAllListeners


removeBrowserView()

removeBrowserView(browserView): void

Note The BrowserView class is deprecated, and replaced by the new WebContentsView class.

Parameters

browserView: BrowserView

Returns

void

Inherited from

BrowserWindow.removeBrowserView


removeListener()

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "always-on-top-changed"

listener

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "always-on-top-changed"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "app-command"

listener

Returns

this

Platform

win32,linux

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "blur"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "close"

listener

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "closed"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "enter-full-screen"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "enter-html-full-screen"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "focus"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "focus"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "hide"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "hide"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "leave-full-screen"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "leave-html-full-screen"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "maximize"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "maximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "minimize"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "minimize"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "move"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "move"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "moved"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "new-window-for-tab"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "page-title-updated"

listener

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "ready-to-show"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "resize"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "resized"

listener: Function

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "responsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "restore"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "rotate-gesture"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "session-end"

listener: Function

Returns

this

Platform

win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "sheet-begin"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "sheet-end"

listener: Function

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "show"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "swipe"

listener

Returns

this

Platform

darwin

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "system-context-menu"

listener

Returns

this

Platform

win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "unmaximize"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "unresponsive"

listener: Function

Returns

this

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "will-move"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener

removeListener(event, listener)

removeListener(event, listener): this

Parameters

event: "will-resize"

listener

Returns

this

Platform

darwin,win32

Inherited from

BrowserWindow.removeListener


removeMenu()

removeMenu(): void

Remove the window’s menu bar.

Returns

void

Platform

linux,win32

Inherited from

BrowserWindow.removeMenu


restore()

restore(): void

Restores the window from minimized state to its previous state.

Returns

void

Inherited from

BrowserWindow.restore


selectNextTab()

selectNextTab(): void

Selects the next tab when native tabs are enabled and there are other tabs in the window.

Returns

void

Platform

darwin

Inherited from

BrowserWindow.selectNextTab


selectPreviousTab()

selectPreviousTab(): void

Selects the previous tab when native tabs are enabled and there are other tabs in the window.

Returns

void

Platform

darwin

Inherited from

BrowserWindow.selectPreviousTab


setAlwaysOnTop()

setAlwaysOnTop(flag, level?, relativeLevel?): void

Sets whether the window should show always on top of other windows. After setting this, the window is still a normal window, not a toolbox window which can not be focused on.

Parameters

flag: boolean

level?: "normal" | "floating" | "torn-off-menu" | "modal-panel" | "main-menu" | "status" | "pop-up-menu" | "screen-saver"

relativeLevel?: number

Returns

void

Inherited from

BrowserWindow.setAlwaysOnTop


setAppDetails()

setAppDetails(options): void

Sets the properties for the window’s taskbar button.

Note: relaunchCommand and relaunchDisplayName must always be set together. If one of those properties is not set, then neither will be used.

Parameters

options: AppDetailsOptions

Returns

void

Platform

win32

Inherited from

BrowserWindow.setAppDetails


setAspectRatio()

setAspectRatio(aspectRatio, extraSize?): void

This will make a window maintain an aspect ratio. The extra size allows a developer to have space, specified in pixels, not included within the aspect ratio calculations. This API already takes into account the difference between a window’s size and its content size.

Consider a normal window with an HD video player and associated controls. Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within the player itself we would call this function with arguments of 16/9 and { width: 40, height: 50 }. The second argument doesn’t care where the extra width and height are within the content view—only that they exist. Sum any extra width and height areas you have within the overall content view.

The aspect ratio is not respected when window is resized programmatically with APIs like win.setSize.

To reset an aspect ratio, pass 0 as the aspectRatio value: win.setAspectRatio(0).

Parameters

aspectRatio: number

extraSize?: Size

Returns

void

Inherited from

BrowserWindow.setAspectRatio


setAutoHideCursor()

setAutoHideCursor(autoHide): void

Controls whether to hide cursor when typing.

Parameters

autoHide: boolean

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setAutoHideCursor


setAutoHideMenuBar()

setAutoHideMenuBar(hide): void

Sets whether the window menu bar should hide itself automatically. Once set the menu bar will only show when users press the single Alt key.

If the menu bar is already visible, calling setAutoHideMenuBar(true) won’t hide it immediately.

Parameters

hide: boolean

Returns

void

Platform

win32,linux

Inherited from

BrowserWindow.setAutoHideMenuBar


setBackgroundColor()

setBackgroundColor(backgroundColor): void

Examples of valid backgroundColor values:

  • Hex
    • #fff (shorthand RGB)
    • #ffff (shorthand ARGB)
    • #ffffff (RGB)
    • #ffffffff (ARGB)
  • RGB
    • rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)
      • e.g. rgb(255, 255, 255)
  • RGBA
    • rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)
      • e.g. rgba(255, 255, 255, 1.0)
  • HSL
    • hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)
      • e.g. hsl(200, 20%, 50%)
  • HSLA
    • hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)
      • e.g. hsla(200, 20%, 50%, 0.5)
  • Color name
    • Options are listed in SkParseColor.cpp
    • Similar to CSS Color Module Level 3 keywords, but case-sensitive.
      • e.g. blueviolet or red

Sets the background color of the window. See Setting backgroundColor.

Parameters

backgroundColor: string

Returns

void

Inherited from

BrowserWindow.setBackgroundColor


setBackgroundMaterial()

setBackgroundMaterial(material): void

This method sets the browser window’s system-drawn background material, including behind the non-client area.

See the Windows documentation for more details.

Note: This method is only supported on Windows 11 22H2 and up.

Parameters

material: "none" | "auto" | "mica" | "acrylic" | "tabbed"

Returns

void

Platform

win32

Inherited from

BrowserWindow.setBackgroundMaterial


setBounds()

setBounds(bounds, animate?): void

Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.

Note: On macOS, the y-coordinate value cannot be smaller than the Tray height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.

Parameters

bounds: Partial<Rectangle>

animate?: boolean

Returns

void

Inherited from

BrowserWindow.setBounds


setBrowserView()

setBrowserView(browserView): void

Note The BrowserView class is deprecated, and replaced by the new WebContentsView class.

Parameters

browserView: null | BrowserView

Returns

void

Inherited from

BrowserWindow.setBrowserView


setClosable()

setClosable(closable): void

Sets whether the window can be manually closed by user. On Linux does nothing.

Parameters

closable: boolean

Returns

void

Platform

darwin,win32

Inherited from

BrowserWindow.setClosable


setContentBounds()

setContentBounds(bounds, animate?): void

Resizes and moves the window’s client area (e.g. the web page) to the supplied bounds.

Parameters

bounds: Rectangle

animate?: boolean

Returns

void

Inherited from

BrowserWindow.setContentBounds


setContentProtection()

setContentProtection(enable): void

Prevents the window contents from being captured by other apps.

On macOS it sets the NSWindow’s sharingType to NSWindowSharingNone. On Windows it calls SetWindowDisplayAffinity with WDA_EXCLUDEFROMCAPTURE. For Windows 10 version 2004 and up the window will be removed from capture entirely, older Windows versions behave as if WDA_MONITOR is applied capturing a black window.

Parameters

enable: boolean

Returns

void

Platform

darwin,win32

Inherited from

BrowserWindow.setContentProtection


setContentSize()

setContentSize(width, height, animate?): void

Resizes the window’s client area (e.g. the web page) to width and height.

Parameters

width: number

height: number

animate?: boolean

Returns

void

Inherited from

BrowserWindow.setContentSize


setContentView()

setContentView(view): void

Sets the content view of the window.

Parameters

view: View

Returns

void

Inherited from

BrowserWindow.setContentView


setDocumentEdited()

setDocumentEdited(edited): void

Specifies whether the window’s document has been edited, and the icon in title bar will become gray when set to true.

Parameters

edited: boolean

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setDocumentEdited


setEnabled()

setEnabled(enable): void

Disable or enable the window.

Parameters

enable: boolean

Returns

void

Inherited from

BrowserWindow.setEnabled


setFocusable()

setFocusable(focusable): void

Changes whether the window can be focused.

On macOS it does not remove the focus from the window.

Parameters

focusable: boolean

Returns

void

Platform

darwin,win32

Inherited from

BrowserWindow.setFocusable


setFullScreen()

setFullScreen(flag): void

Sets whether the window should be in fullscreen mode.

Note: On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ‘enter-full-screen’ or ‘leave-full-screen’ events.

Parameters

flag: boolean

Returns

void

Inherited from

BrowserWindow.setFullScreen


setFullScreenable()

setFullScreenable(fullscreenable): void

Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.

Parameters

fullscreenable: boolean

Returns

void

Inherited from

BrowserWindow.setFullScreenable


setHasShadow()

setHasShadow(hasShadow): void

Sets whether the window should have a shadow.

Parameters

hasShadow: boolean

Returns

void

Inherited from

BrowserWindow.setHasShadow


setHiddenInMissionControl()

setHiddenInMissionControl(hidden): void

Sets whether the window will be hidden when the user toggles into mission control.

Parameters

hidden: boolean

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setHiddenInMissionControl


setIcon()

setIcon(icon): void

Changes window icon.

Parameters

icon: string | NativeImage

Returns

void

Platform

win32,linux

Inherited from

BrowserWindow.setIcon


setIgnoreMouseEvents()

setIgnoreMouseEvents(ignore, options?): void

Makes the window ignore all mouse events.

All mouse events happened in this window will be passed to the window below this window, but if this window has focus, it will still receive keyboard events.

Parameters

ignore: boolean

options?: IgnoreMouseEventsOptions

Returns

void

Inherited from

BrowserWindow.setIgnoreMouseEvents


setKiosk()

setKiosk(flag): void

Enters or leaves kiosk mode.

Parameters

flag: boolean

Returns

void

Inherited from

BrowserWindow.setKiosk


setMaximizable()

setMaximizable(maximizable): void

Sets whether the window can be manually maximized by user. On Linux does nothing.

Parameters

maximizable: boolean

Returns

void

Platform

darwin,win32

Inherited from

BrowserWindow.setMaximizable


setMaximumSize()

setMaximumSize(width, height): void

Sets the maximum size of window to width and height.

Parameters

width: number

height: number

Returns

void

Inherited from

BrowserWindow.setMaximumSize


setMaxListeners()

setMaxListeners(n): this

By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set toInfinity (or 0) to indicate an unlimited number of listeners.

Returns a reference to the EventEmitter, so that calls can be chained.

Parameters

n: number

Returns

this

Since

v0.3.5

Inherited from

BrowserWindow.setMaxListeners


setMenu()

setMenu(menu): void

Sets the menu as the window’s menu bar.

Parameters

menu: null | Menu

Returns

void

Platform

linux,win32

Inherited from

BrowserWindow.setMenu


setMenuBarVisibility()

setMenuBarVisibility(visible): void

Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single Alt key.

Parameters

visible: boolean

Returns

void

Platform

win32,linux

Inherited from

BrowserWindow.setMenuBarVisibility


setMinimizable()

setMinimizable(minimizable): void

Sets whether the window can be manually minimized by user. On Linux does nothing.

Parameters

minimizable: boolean

Returns

void

Platform

darwin,win32

Inherited from

BrowserWindow.setMinimizable


setMinimumSize()

setMinimumSize(width, height): void

Sets the minimum size of window to width and height.

Parameters

width: number

height: number

Returns

void

Inherited from

BrowserWindow.setMinimumSize


setMovable()

setMovable(movable): void

Sets whether the window can be moved by user. On Linux does nothing.

Parameters

movable: boolean

Returns

void

Platform

darwin,win32

Inherited from

BrowserWindow.setMovable


setOpacity()

setOpacity(opacity): void

Sets the opacity of the window. On Linux, does nothing. Out of bound number values are clamped to the [0, 1] range.

Parameters

opacity: number

Returns

void

Platform

win32,darwin

Inherited from

BrowserWindow.setOpacity


setOverlayIcon()

setOverlayIcon(overlay, description): void

Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user.

Parameters

overlay: null | NativeImage

description: string

Returns

void

Platform

win32

Inherited from

BrowserWindow.setOverlayIcon


setParentWindow()

setParentWindow(parent): void

Sets parent as current window’s parent window, passing null will turn current window into a top-level window.

Parameters

parent: null | BrowserWindow

Returns

void

Inherited from

BrowserWindow.setParentWindow


setPosition()

setPosition(x, y, animate?): void

Moves window to x and y.

Parameters

x: number

y: number

animate?: boolean

Returns

void

Inherited from

BrowserWindow.setPosition


setProgressBar()

setProgressBar(progress, options?): void

Sets progress value in progress bar. Valid range is [0, 1.0].

Remove progress bar when progress < 0; Change to indeterminate mode when progress > 1.

On Linux platform, only supports Unity desktop environment, you need to specify the *.desktop file name to desktopName field in package.json. By default, it will assume {app.name}.desktop.

On Windows, a mode can be passed. Accepted values are none, normal, indeterminate, error, and paused. If you call setProgressBar without a mode set (but with a value within the valid range), normal will be assumed.

Parameters

progress: number

options?: ProgressBarOptions

Returns

void

Inherited from

BrowserWindow.setProgressBar


setRepresentedFilename()

setRepresentedFilename(filename): void

Sets the pathname of the file the window represents, and the icon of the file will show in window’s title bar.

Parameters

filename: string

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setRepresentedFilename


setResizable()

setResizable(resizable): void

Sets whether the window can be manually resized by the user.

Parameters

resizable: boolean

Returns

void

Inherited from

BrowserWindow.setResizable


setShape()

setShape(rects): void

Setting a window shape determines the area within the window where the system permits drawing and user interaction. Outside of the given region, no pixels will be drawn and no mouse events will be registered. Mouse events outside of the region will not be received by that window, but will fall through to whatever is behind the window.

Parameters

rects: Rectangle[]

Returns

void

Platform

win32,linux

Inherited from

BrowserWindow.setShape


setSheetOffset()

setSheetOffset(offsetY, offsetX?): void

Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. For example:

Parameters

offsetY: number

offsetX?: number

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setSheetOffset


setSimpleFullScreen()

setSimpleFullScreen(flag): void

Enters or leaves simple fullscreen mode.

Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).

Parameters

flag: boolean

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setSimpleFullScreen


setSize()

setSize(width, height, animate?): void

Resizes the window to width and height. If width or height are below any set minimum size constraints the window will snap to its minimum size.

Parameters

width: number

height: number

animate?: boolean

Returns

void

Inherited from

BrowserWindow.setSize


setSkipTaskbar()

setSkipTaskbar(skip): void

Makes the window not show in the taskbar.

Parameters

skip: boolean

Returns

void

Platform

darwin,win32

Inherited from

BrowserWindow.setSkipTaskbar


setThumbarButtons()

setThumbarButtons(buttons): boolean

Whether the buttons were added successfully

Add a thumbnail toolbar with a specified set of buttons to the thumbnail image of a window in a taskbar button layout. Returns a boolean object indicates whether the thumbnail has been added successfully.

The number of buttons in thumbnail toolbar should be no greater than 7 due to the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be removed due to the platform’s limitation. But you can call the API with an empty array to clean the buttons.

The buttons is an array of Button objects:

  • Button Object
    • icon NativeImage - The icon showing in thumbnail toolbar.
    • click Function
    • tooltip string (optional) - The text of the button’s tooltip.
    • flags string[] (optional) - Control specific states and behaviors of the button. By default, it is ['enabled'].

The flags is an array that can include following strings:

  • enabled - The button is active and available to the user.
  • disabled - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.
  • dismissonclick - When the button is clicked, the thumbnail window closes immediately.
  • nobackground - Do not draw a button border, use only the image.
  • hidden - The button is not shown to the user.
  • noninteractive - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.

Parameters

buttons: ThumbarButton[]

Returns

boolean

Platform

win32

Inherited from

BrowserWindow.setThumbarButtons


setThumbnailClip()

setThumbnailClip(region): void

Sets the region of the window to show as the thumbnail image displayed when hovering over the window in the taskbar. You can reset the thumbnail to be the entire window by specifying an empty region: { x: 0, y: 0, width: 0, height: 0 }.

Parameters

region: Rectangle

Returns

void

Platform

win32

Inherited from

BrowserWindow.setThumbnailClip


setThumbnailToolTip()

setThumbnailToolTip(toolTip): void

Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.

Parameters

toolTip: string

Returns

void

Platform

win32

Inherited from

BrowserWindow.setThumbnailToolTip


setTitle()

setTitle(title): void

Changes the title of native window to title.

Parameters

title: string

Returns

void

Inherited from

BrowserWindow.setTitle


setTitleBarOverlay()

setTitleBarOverlay(options): void

On a window with Window Controls Overlay already enabled, this method updates the style of the title bar overlay.

On Linux, the symbolColor is automatically calculated to have minimum accessible contrast to the color if not explicitly set.

Parameters

options: TitleBarOverlayOptions

Returns

void

Platform

win32,linux

Inherited from

BrowserWindow.setTitleBarOverlay


setTopBrowserView()

setTopBrowserView(browserView): void

Raises browserView above other BrowserViews attached to win. Throws an error if browserView is not attached to win.

Note The BrowserView class is deprecated, and replaced by the new WebContentsView class.

Parameters

browserView: BrowserView

Returns

void

Inherited from

BrowserWindow.setTopBrowserView


setTouchBar()

setTouchBar(touchBar): void

Sets the touchBar layout for the current window. Specifying null or undefined clears the touch bar. This method only has an effect if the machine has a touch bar.

Note: The TouchBar API is currently experimental and may change or be removed in future Electron releases.

Parameters

touchBar: null | TouchBar

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setTouchBar


setVibrancy()

setVibrancy(type): void

Adds a vibrancy effect to the browser window. Passing null or an empty string will remove the vibrancy effect on the window.

Parameters

type: null | "window" | "titlebar" | "selection" | "menu" | "popover" | "sidebar" | "header" | "sheet" | "hud" | "fullscreen-ui" | "tooltip" | "content" | "under-window" | "under-page"

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setVibrancy


setVisibleOnAllWorkspaces()

setVisibleOnAllWorkspaces(visible, options?): void

Sets whether the window should be visible on all workspaces.

Note: This API does nothing on Windows.

Parameters

visible: boolean

options?: VisibleOnAllWorkspacesOptions

Returns

void

Platform

darwin,linux

Inherited from

BrowserWindow.setVisibleOnAllWorkspaces


setWindowButtonPosition()

setWindowButtonPosition(position): void

Set a custom position for the traffic light buttons in frameless window. Passing null will reset the position to default.

Parameters

position: null | Point

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setWindowButtonPosition


setWindowButtonVisibility()

setWindowButtonVisibility(visible): void

Sets whether the window traffic light buttons should be visible.

Parameters

visible: boolean

Returns

void

Platform

darwin

Inherited from

BrowserWindow.setWindowButtonVisibility


show()

show(): void

Shows and gives focus to the window.

Returns

void

Inherited from

BrowserWindow.show


showAllTabs()

showAllTabs(): void

Shows or hides the tab overview when native tabs are enabled.

Returns

void

Platform

darwin

Inherited from

BrowserWindow.showAllTabs


showDefinitionForSelection()

showDefinitionForSelection(): void

Same as webContents.showDefinitionForSelection().

Returns

void

Platform

darwin

Inherited from

BrowserWindow.showDefinitionForSelection


showInactive()

showInactive(): void

Shows the window but doesn’t focus on it.

Returns

void

Inherited from

BrowserWindow.showInactive


toggleTabBar()

toggleTabBar(): void

Toggles the visibility of the tab bar if native tabs are enabled and there is only one tab in the current window.

Returns

void

Platform

darwin

Inherited from

BrowserWindow.toggleTabBar


unhookAllWindowMessages()

unhookAllWindowMessages(): void

Unhooks all of the window messages.

Returns

void

Platform

win32

Inherited from

BrowserWindow.unhookAllWindowMessages


unhookWindowMessage()

unhookWindowMessage(message): void

Unhook the window message.

Parameters

message: number

Returns

void

Platform

win32

Inherited from

BrowserWindow.unhookWindowMessage


unmaximize()

unmaximize(): void

Unmaximizes the window.

Returns

void

Inherited from

BrowserWindow.unmaximize