new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · API · all subjects

app/events

156 notes in this subject, read out of this brain and free to use. This is page 3 of 3.

webview did-stop-loading event

Event corresponds to the points in time when the spinner of the tab stops spinning.

webview did-attach event

Event fired when attached to the embedder web contents.

webview dom-ready event

Event fired when document in the given frame is loaded.

webview page-title-updated event

Event fired when page title is set during navigation. Returns: title (string), explicitSet (boolean - false when title is synthesized from file url).

BaseWindow 'close' event

The 'close' event is emitted when the window is going to be closed, before the beforeunload and unload events of the DOM. Calling event.preventDefault() will cancel the close. The event returns an Event object. In Electron, returning any value other than undefined from beforeunload will cancel the close.

BaseWindow beforeunload behavior differs from browsers

It is recommended to always set event.returnValue explicitly in beforeunload handlers rather than only returning a value, as the former works more consistently within Electron. Unlike usual browsers where a message box is prompted to users, returning a non-void value will silently cancel the close.

BaseWindow 'closed' event

The 'closed' event is emitted when the window is closed. After you receive this event you should remove the reference to the window and avoid using it any more.

BaseWindow 'session-end' event (Windows only)

The 'session-end' event is emitted on Windows when a session is about to end due to shutdown, machine restart, or user log-off. Returns a WindowSessionEndEvent object. Once this event fires, there is no way to prevent the session from ending.

BaseWindow 'blur' event

The 'blur' event is emitted when the window loses focus. Returns an Event object.

BaseWindow 'focus' event

The 'focus' event is emitted when the window gains focus. Returns an Event object.

BaseWindow 'show' event

The 'show' event is emitted when the window is shown.

BaseWindow 'hide' event

The 'hide' event is emitted when the window is hidden.

BaseWindow 'maximize' event

The 'maximize' event is emitted when the window is maximized.

BaseWindow 'unmaximize' event

The 'unmaximize' event is emitted when the window exits from a maximized state.

BaseWindow 'minimize' event

The 'minimize' event is emitted when the window is minimized. On Wayland, 'minimized' is not currently a supported state and the minimize event will only fire when triggered by client-side decoration, such as clicking the minimize button on a frameless window's Window Control Overlay.

BaseWindow 'restore' event

The 'restore' event is emitted when the window is restored from a minimized state.

BaseWindow 'will-resize' event (macOS and Windows)

The 'will-resize' event is emitted on macOS and Windows before the window is resized. Calling event.preventDefault() will prevent the window from being resized. Returns: event (Event), newBounds (Rectangle - size the window is being resized to), and details (Object) containing edge property (string - the edge being dragged: bottom, left, right, top-left, top-right, bottom-left, or bottom-right). This is only emitted when the window is being resized manually, not when resizing with setBounds/setSize.

BaseWindow 'will-resize' edge values platform differences

On Windows, will-resize edge can be: bottom, top, left, right, top-left, top-right, bottom-left, bottom-right. On macOS, will-resize edge can be: bottom (for vertical resizing) or right (for horizontal resizing).

BaseWindow 'resize' event

The 'resize' event is emitted after the window has been resized.

BaseWindow 'resized' event (macOS and Windows)

The 'resized' event is emitted on macOS and Windows 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.

BaseWindow 'will-move' event (macOS and Windows)

The 'will-move' event is emitted on macOS and Windows before the window is moved. On Windows, calling event.preventDefault() will prevent the window from being moved. Returns: event (Event) and newBounds (Rectangle - location the window is being moved to). This is only emitted when the window is being moved manually, not when moving with setPosition/setBounds/center.

BaseWindow 'move' event

The 'move' event is emitted when the window is being moved to a new position.

BaseWindow 'moved' event (macOS and Windows)

The 'moved' event is emitted on macOS and Windows once when the window is moved to a new position. On macOS, this event is an alias of the move event.

BaseWindow 'enter-full-screen' event

The 'enter-full-screen' event is emitted when the window enters a full-screen state.

BaseWindow 'leave-full-screen' event

The 'leave-full-screen' event is emitted when the window leaves a full-screen state.

BaseWindow 'always-on-top-changed' event

The 'always-on-top-changed' event is emitted when the window is set or unset to show always on top of other windows. Returns: event (Event) and isAlwaysOnTop (boolean).

BaseWindow 'app-command' event (Windows and Linux)

The 'app-command' event is emitted on Windows and Linux when an App Command is invoked, typically related to keyboard media keys or browser commands, as well as the back button on some mice. Returns: event (Event) and command (string). 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).

BaseWindow 'app-command' supported on Linux

On Linux, the following app commands are explicitly supported: browser-backward and browser-forward.

BaseWindow 'swipe' event (macOS)

The 'swipe' event is emitted on macOS on 3-finger swipe. Returns: event (Event) and direction (string - up, right, down, or left). The method underlying this event is built to handle older macOS-style trackpad swiping where the content doesn't move with the swipe. Most macOS trackpads no longer support this behavior; the 'Swipe between pages' preference in System Preferences > Trackpad > More Gestures must be set to 'Swipe with two or three fingers'.

BaseWindow 'rotate-gesture' event (macOS)

The 'rotate-gesture' event is emitted on macOS on trackpad rotation gesture. Continually emitted until rotation gesture ends. Returns: event (Event) and rotation (Float - angle in degrees rotated since 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.

BaseWindow 'sheet-begin' event (macOS)

The 'sheet-begin' event is emitted on macOS when the window opens a sheet.

BaseWindow 'sheet-end' event (macOS)

The 'sheet-end' event is emitted on macOS when the window has closed a sheet.

BaseWindow 'new-window-for-tab' event (macOS)

The 'new-window-for-tab' event is emitted on macOS when the user clicks the native macOS new tab button. The new tab button is only visible if the current BaseWindow has a tabbingIdentifier. You must create a window in this handler in order for macOS tabbing to work as expected.

BaseWindow 'system-context-menu' event (Windows and Linux)

The 'system-context-menu' event is emitted on Windows and Linux when the system context menu is triggered on the window, normally only when the user right-clicks on the non-client area (titlebar or any area declared as -webkit-app-region: drag in a frameless window). Returns: event (Event) and point (Point - screen coordinates where context menu was triggered). Calling event.preventDefault() will prevent the menu from being displayed.

BaseWindow 'persisted-state-restored' event

The 'persisted-state-restored' event is emitted after the persisted window state has been restored. Window state includes the window bounds (x, y, height, width) and display mode (maximized, fullscreen, kiosk). This event is only emitted when windowStatePersistence is enabled in BaseWindowConstructorOptions or BrowserWindowConstructorOptions.

App quit on window-all-closed example

// quitting the app when no windows are open on non-macOS platforms app.on('window-all-closed', () => { if (process.platform !== 'darwin') app.quit() })

Give your agent this brain