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

webcontents/events

56 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Event: did-finish-load

Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, and the onload event was dispatched.

Event: did-fail-load

Emitted when the load failed. Parameters: event (Event), errorCode (Integer), errorDescription (string), validatedURL (string), isMainFrame (boolean), frameProcessId (Integer), frameRoutingId (Integer). The full list of error codes and their meaning is available at https://source.chromium.org/chromium/chromium/src/+/main:net/base/net_error_list.h.

Event: did-fail-provisional-load

Emitted when the load was cancelled, such as when window.stop() was invoked. Parameters: event (Event), errorCode (Integer), errorDescription (string), validatedURL (string), isMainFrame (boolean), frameProcessId (Integer), frameRoutingId (Integer).

Event: did-frame-finish-load

Emitted when a frame has done navigation. Parameters: event (Event), isMainFrame (boolean), frameProcessId (Integer), frameRoutingId (Integer).

Event: did-start-loading

Corresponds to the points in time when the spinner of the tab started spinning.

Event: did-stop-loading

Corresponds to the points in time when the spinner of the tab stopped spinning.

Event: dom-ready

Emitted when the document in the top-level frame is loaded.

Event: page-title-updated

Emitted when page title is set during navigation. Parameters: event (Event), title (string), explicitSet (boolean). explicitSet is false when title is synthesized from file url.

Event: page-favicon-updated

Emitted when page receives favicon urls. Parameters: event (Event), favicons (string[]) - array of URLs.

Event: content-bounds-updated

Emitted when the page calls window.moveTo, window.resizeTo or related APIs. Parameters: event (Event), bounds (Rectangle) - requested new content bounds. By default, this will move the window. To prevent that behavior, call event.preventDefault().

Event: did-create-window

Emitted after successful creation of a window via window.open in the renderer. Parameters: window (BrowserWindow), details (Object) containing: url (string), frameName (string), options (BrowserWindowConstructorOptions), referrer (Referrer), postBody (PostBody, optional), disposition (string - can be 'default', 'foreground-tab', 'background-tab', 'new-window', or 'other'). Not emitted if the creation of the window is canceled from webContents.setWindowOpenHandler.

Event: will-navigate

Emitted when a user or the page wants to start navigation on the main frame. It can happen when the window.location object is changed or a user clicks a link in the page. Parameters: details (Object) with url (string), isSameDocument (boolean - always false for this event), isMainFrame (boolean), frame (WebFrameMain | null), initiator (WebFrameMain | null, optional). This event will not emit when navigation is started programmatically with APIs like webContents.loadURL and webContents.back. It is also not emitted for in-page navigations such as clicking anchor links or updating window.location.hash. Calling event.preventDefault() will prevent the navigation. Deprecated parameters: url, isInPlace, isMainFrame, frameProcessId, frameRoutingId.

Event: will-frame-navigate

Emitted when a user or the page wants to start navigation in any frame. Unlike will-navigate, will-frame-navigate is fired when the main frame or any of its subframes attempts to navigate. When the navigation event comes from the main frame, isMainFrame will be true. Parameters: details (Object) with url (string), isSameDocument (boolean - always false for this event), isMainFrame (boolean), frame (WebFrameMain | null), initiator (WebFrameMain | null, optional). This event will not emit when navigation is started programmatically with APIs like webContents.loadURL and webContents.back. It is also not emitted for in-page navigations. Calling event.preventDefault() will prevent the navigation.

Event: did-start-navigation

Emitted when any frame (including main) starts navigating. Parameters: details (Object) with url (string), isSameDocument (boolean), isMainFrame (boolean), frame (WebFrameMain | null), initiator (WebFrameMain | null, optional). Deprecated parameters: url, isInPlace, isMainFrame, frameProcessId, frameRoutingId.

Event: did-redirect-navigation

Emitted after a server side redirect occurs during navigation, for example a 302 redirect. This event cannot be prevented; if you want to prevent redirects, check the will-redirect event. Parameters: details (Object) with url (string), isSameDocument (boolean), isMainFrame (boolean), frame (WebFrameMain | null), initiator (WebFrameMain | null, optional). Deprecated parameters: url, isInPlace, isMainFrame, frameProcessId, frameRoutingId.

Event: did-frame-navigate

Emitted when any frame navigation is done. Parameters: event (Event), url (string), httpResponseCode (Integer - -1 for non HTTP navigations), httpStatusText (string - empty for non HTTP navigations), isMainFrame (boolean), frameProcessId (Integer), frameRoutingId (Integer). This event is not emitted for in-page navigations such as clicking anchor links or updating window.location.hash.

Event: did-navigate-in-page

Emitted when an in-page navigation happened in any frame. When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered. Parameters: event (Event), url (string), isMainFrame (boolean), frameProcessId (Integer), frameRoutingId (Integer).

Event: will-prevent-unload

Emitted when a beforeunload event handler is attempting to cancel a page unload. Parameters: event (Event). Calling event.preventDefault() will ignore the beforeunload event handler and allow the page to be unloaded. This will be emitted for BrowserViews but will not be respected because BrowserView lifecycle is not tied to its owning BrowserWindow.

Event: render-process-gone

Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed. Parameters: event (Event), details (RenderProcessGoneDetails).

Event: unresponsive

Emitted when the web page becomes unresponsive.

Event: responsive

Emitted when the unresponsive web page becomes responsive again.

Event: destroyed

Emitted when webContents is destroyed.

Event: input-event

Emitted when an input event is sent to the WebContents. Parameters: event (Event), inputEvent (InputEvent).

Event: before-input-event

Emitted before dispatching the keydown and keyup events in the page. Parameters: event (Event), input (Object) containing: type (string - 'keyUp' or 'keyDown'), key (string), code (string), isAutoRepeat (boolean), isComposing (boolean), shift (boolean), control (boolean), alt (boolean), meta (boolean), location (number), modifiers (string[]). Calling event.preventDefault will prevent the page keydown/keyup events and the menu shortcuts. To only prevent the menu shortcuts, use setIgnoreMenuShortcuts.

Event: before-mouse-event

Emitted before dispatching mouse events in the page. Parameters: event (Event), mouse (MouseInputEvent). Calling event.preventDefault will prevent the page mouse events.

Event: leave-html-full-screen

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

Event: zoom-changed

Emitted when the user is requesting to change the zoom level using the mouse wheel. Parameters: event (Event), zoomDirection (string - can be 'in' or 'out').

Event: blur

Emitted when the WebContents loses focus.

Event: focus on macOS behavior

On macOS, having focus means the WebContents is the first responder of window, so switching focus between windows would not trigger the focus and blur events of WebContents, as the first responder of each window is not changed. The focus and blur events of WebContents should only be used to detect focus change between different WebContents and BrowserView in the same window.

Event: focus

Emitted when the WebContents gains focus.

Event: devtools-open-url

Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu. Parameters: event (Event), url (string) - URL of the link that was clicked or selected.

Event: devtools-search-query

Emitted when 'Search' is selected for text in its context menu. Parameters: event (Event), query (string) - text to query for.

Event: devtools-closed

Emitted when DevTools is closed.

Event: devtools-focused

Emitted when DevTools is focused / opened.

Event: certificate-error

Emitted when failed to verify the certificate for url. Parameters: event (Event), url (string), error (string) - the error code, certificate (Certificate), callback (Function) taking isTrusted (boolean), isMainFrame (boolean). The usage is the same as the certificate-error event of app.

Event: select-client-certificate

Emitted when a client certificate is requested. Parameters: event (Event), url (URL), certificateList (Certificate[]), callback (Function) taking certificate (Certificate) which must be from the given list. The usage is the same as the select-client-certificate event of app.

Event: login

Emitted when webContents wants to do basic auth. Parameters: event (Event), authenticationResponseDetails (Object) containing url (URL), pid (number), isRequestForNavigation (boolean), firstAuthAttempt (boolean), responseHeaders (Record<string, string | string[]>, optional), authInfo (Object) containing isProxy (boolean), scheme (string), host (string), port (Integer), realm (string), callback (Function) taking username (string, optional), password (string, optional). The usage is the same as the login event of app.

Event: found-in-page

Emitted when a result is available for webContents.findInPage request. Parameters: event (Event), result (Object) containing requestId (Integer), activeMatchOrdinal (Integer), matches (Integer), selectionArea (Rectangle), finalUpdate (boolean).

Event: media-started-playing

Emitted when media starts playing.

Event: media-paused

Emitted when media is paused or done playing.

Event: audio-state-changed

Emitted when media becomes audible or inaudible. Parameters: event (Event) with audible (boolean) - true if one or more frames or child webContents are emitting audio.

Event: did-change-theme-color

Emitted when a page's theme color changes. This is usually due to encountering a meta tag like <meta name='theme-color' content='#ff0000'>. Parameters: event (Event), color (string | null) - theme color is in format of '#rrggbb', or null when no theme color is set.

Event: update-target-url

Emitted when mouse moves over a link or the keyboard moves the focus to a link. Parameters: event (Event), url (string).

Event: cursor-changed cursor types

The type parameter in cursor-changed event can be: pointer, crosshair, hand, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, nwse-resize, col-resize, row-resize, m-panning, m-panning-vertical, m-panning-horizontal, e-panning, n-panning, ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, not-allowed, zoom-in, zoom-out, grab, grabbing, custom, null, drag-drop-none, drag-drop-move, drag-drop-copy, drag-drop-link, ns-no-resize, ew-no-resize, nesw-no-resize, nwse-no-resize, or default.

Event: cursor-changed

Emitted when the cursor's type changes. Parameters: event (Event), type (string), image (NativeImage, optional), scale (Float, optional) - scaling factor for the custom cursor, size (Size, optional), hotspot (Point, optional) - coordinates of the custom cursor's hotspot. If the type parameter is 'custom', the image parameter will hold the custom cursor image in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.

Event: context-menu full parameter table

Emitted when there is a new context menu that needs to be handled. Parameters: event (Event), params (Object) containing: x (Integer), y (Integer), frame (WebFrameMain | null), linkURL (string), linkText (string), pageURL (string), frameURL (string), srcURL (string), mediaType (string - can be 'none', 'image', 'audio', 'video', 'canvas', 'file', 'plugin'), hasImageContents (boolean), isEditable (boolean), selectionText (string), titleText (string), altText (string), suggestedFilename (string), selectionRect (Rectangle), selectionStartOffset (number), referrerPolicy (Referrer), misspelledWord (string), dictionarySuggestions (string[]), frameCharset (string), formControlType (string - possible values: 'none', 'button-button', 'field-set', 'input-button', 'input-checkbox', 'input-color', 'input-date', 'input-datetime-local', 'input-email', 'input-file', 'input-hidden', 'input-image', 'input-month', 'input-number', 'input-password', 'input-radio', 'input-range', 'input-reset', 'input-search', 'input-submit', 'input-telephone', 'input-text', 'input-time', 'input-url', 'input-week', 'output', 'reset-button', 'select-list', 'select-multiple', 'select-one', 'submit-button', 'text-area'), spellcheckEnabled (boolean), menuSourceType (string - can be 'none', 'mouse', 'keyboard', 'touch', 'touchMenu', 'longPress', 'longTap', 'touchHandle', 'stylus', 'adjustSelection', 'adjustSelectionReset'), mediaFlags (Object) containing inError, isPaused, isMuted, hasAudio, isLooping, isControlsVisible, canToggleControls, canPrint, canSave, canShowPictureInPicture, isShowingPictureInPicture, canRotate, canLoop, editFlags (Object) containing canUndo, canRedo, canCut, canCopy, canPaste, canDelete, canSelectAll, canEditRichly.

Event: select-bluetooth-device

Emitted when a bluetooth device needs to be selected when a call to navigator.bluetooth.requestDevice is made. Parameters: event (Event), devices (BluetoothDevice[]), callback (Function) taking deviceId (string). Passing an empty string to callback will cancel the request. If no event listener is added for this event, all bluetooth requests will be cancelled. If event.preventDefault is not called when handling this event, the first available device will be automatically selected. Due to the nature of bluetooth, scanning for devices when navigator.bluetooth.requestDevice is called may take time and will cause select-bluetooth-device to fire multiple times until callback is called with either a device id or an empty string to cancel the request.

Event: paint offscreen rendering

Emitted when a new frame is generated. Only the dirty area is passed in the buffer. Parameters: details (Object) with texture (OffscreenSharedTexture, optional, experimental) - the GPU shared texture of the frame when webPreferences.offscreen.useSharedTexture is true, dirtyRect (Rectangle), image (NativeImage) - the image data of the whole frame. When using shared texture feature, you can pass the texture handle to external rendering pipeline without the overhead of copying data between CPU and GPU memory, with Chromium's hardware acceleration support. Only a limited number of textures can exist at the same time, so it's important that you call texture.release() as soon as you're done with the texture.

Event: devtools-reload-page

Emitted when the DevTools window instructs the webContents to reload.

Event: will-attach-webview

Emitted when a <webview>'s web contents is being attached to this web contents. Parameters: event (Event), webPreferences (WebPreferences) - the web preferences that will be used by the guest page (this object can be modified to adjust the preferences), params (Record<string, string>) - the other <webview> parameters such as the src URL (this object can be modified to adjust the parameters). Calling event.preventDefault() will destroy the guest page. This event can be used to configure webPreferences for the webContents of a <webview> before it's loaded.

Event: did-attach-webview

Emitted when a <webview> has been attached to this web contents. Parameters: event (Event), webContents (WebContents) - the guest web contents that is used by the <webview>.

Event: console-message

Emitted when the associated window logs a console message. Parameters: details (Object) with message (string), level (string - possible values: 'info', 'warning', 'error', 'debug'), lineNumber (Integer), sourceId (string) - URL of the log source, frame (WebFrameMain). Deprecated parameters: level (Integer from 0 to 3 matching 'verbose', 'info', 'warning', 'error'), message (string), line (Integer), sourceId (string).

Event: preload-error

Emitted when the preload script preloadPath throws an unhandled exception error. Parameters: event (Event), preloadPath (string), error (Error).

Event: ipc-message-sync

Emitted when the renderer process sends a synchronous message via ipcRenderer.sendSync(). Parameters: event (IpcMainEvent), channel (string), ...args (any[]). Also see webContents.ipc which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.

Event: preferred-size-changed

Emitted when the WebContents preferred size has changed. Parameters: event (Event), preferredSize (Size) - the minimum size needed to contain the layout of the document without requiring scrolling. This event will only be emitted when enablePreferredSizeMode is set to true in webPreferences.

Event: frame-created

Emitted when the mainFrame, an <iframe>, or a nested <iframe> is loaded within the page. Parameters: event (Event), details (Object) with frame (WebFrameMain | null) - the created frame.

Give your agent this brain