on
Emitted when the window is set or unset to show always on top of other windows.
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
Emitted when the window loses focus.
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.
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.
Emitted when the window enters a full-screen state.
Emitted when the window enters a full-screen state triggered by HTML API.
Emitted when the window gains focus.
Emitted when the window is hidden.
Emitted when the window leaves a full-screen state.
Emitted when the window leaves a full-screen state triggered by HTML API.
Emitted when window is maximized.
Emitted when the window is minimized.
Emitted when the window is being moved to a new position.
Emitted once when the window is moved to a new position.
Note: On macOS this event is an alias of move
.
Emitted when the native new tab button is clicked.
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.
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
Emitted after the window has been resized.
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.
Emitted when the unresponsive web page becomes responsive again.
Emitted when the window is restored from a minimized state.
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.
Emitted when window session is going to end due to force shutdown or machine restart or session log off.
Emitted when the window opens a sheet.
Emitted when the window has closed a sheet.
Emitted when the window is shown.
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'.
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.
Emitted when the window exits from a maximized state.
Emitted when the web page becomes unresponsive.
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.
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
andright
.The value
bottom
is used to denote vertical resizing.The value
right
is used to denote horizontal resizing.