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/structure

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

SharedTextureImportTextureInfo visibleRect property

The visibleRect property is an optional Rectangle object that defines a subsection of the coded size, with coordinates [0, 0, codedSize.width, codedSize.height]. In common cases, it represents the full section area.

SharedTextureImportTextureInfo timestamp property

The timestamp property is an optional number representing a timestamp in microseconds that will be reflected to VideoFrame.

SharedTextureImportTextureInfo handle property

The handle property is a required SharedTextureHandle object that represents the shared texture handle.

SharedTextureImportTextureInfo colorSpace property

The colorSpace property is an optional ColorSpace object that specifies the color space of the texture.

SharedTextureImportTextureInfo object structure

SharedTextureImportTextureInfo is an object with the following properties: pixelFormat (string, required), colorSpace (ColorSpace, optional), codedSize (Size, required), visibleRect (Rectangle, optional), timestamp (number, optional), and handle (SharedTextureHandle, required).

SharedTextureImportTextureInfo pixelFormat values

The pixelFormat property accepts the following string values: bgra (32bpp BGRA byte-order, 1 plane), rgba (32bpp RGBA byte-order, 1 plane), rgbaf16 (half float RGBA, 1 plane), nv12 (12bpp with Y plane followed by 2x2 interleaved UV plane), nv16 (16bpp with Y plane followed by 2x1 interleaved UV plane), and p010le (4:2:0 10-bit YUV little-endian with Y plane followed by 2x2 interleaved UV plane).

SharedTextureImportTextureInfo codedSize property

The codedSize property is a required Size object that specifies the full dimensions of the shared texture.

SharedTextureImportedSubtle structure overview

SharedTextureImportedSubtle is an object with methods for managing imported shared textures: getVideoFrame creates a VideoFrame, release releases resources with optional completion callback, startTransferSharedTexture creates a transferable object, getFrameCreationSyncToken returns a sync token for advanced synchronization, and setReleaseSyncToken sets a sync token to control resource lifetime.

SharedTextureImported object structure

The SharedTextureImported object has the following properties and methods: textureId (string) - the unique identifier of the imported shared texture; getVideoFrame (Function that returns VideoFrame) - creates a VideoFrame that uses the imported shared texture in the current process, VideoFrame.close() can be called when finished and the underlying resources wait for GPU finish internally; release (Function) - releases the object's reference to the imported shared texture, with the underlying resource staying alive until every reference is released; subtle (SharedTextureImportedSubtle object) - provides subtle APIs for advanced users to interact with the imported shared texture.

SharedTextureSyncToken structure fields

SharedTextureSyncToken object has one field: syncToken (string) - The opaque data for sync token.

SharedWorkerInfo object structure

The SharedWorkerInfo object contains two properties: id (string) which is the unique identifier of the shared worker, and url (string) which is the url of the shared worker.

SharedTextureTransfer object structure

The SharedTextureTransfer object contains the following properties, all readonly: transfer (string) - The opaque transfer data of the shared texture that can be transferred across Electron processes. syncToken (string) - The opaque sync token data for frame creation. pixelFormat (string) - The pixel format of the transferring texture. codedSize (Size) - The full dimensions of the shared texture. visibleRect (Rectangle) - A subsection of the coded size area, typically the full section area in common cases. timestamp (number) - A timestamp in microseconds that will be reflected to VideoFrame.

SharingItem object structure

The SharingItem object has three optional properties. The `texts` property is an array of strings to share. The `filePaths` property is an array of strings representing file paths to share. The `urls` property is an array of strings representing URLs to share.

ShortcutDetails object structure

The ShortcutDetails object contains the following properties: target (string, required) - The target to launch from this shortcut; cwd (string, optional, default empty) - The working directory; args (string, optional, default empty) - The arguments to be applied to target when launching; description (string, optional, default empty) - The description of the shortcut; icon (string, optional, default empty) - The path to the icon, can be a DLL or EXE, must be set together with iconIndex; iconIndex (number, optional, default 0) - The resource ID of icon when icon is a DLL or EXE; appUserModelId (string, optional, default empty) - The Application User Model ID; toastActivatorClsid (string, optional, default empty) - The Application Toast Activator CLSID, needed for participating in Action Center.

Size Object structure

The Size Object has two properties: width (number) and height (number).

Task object structure

The Task object has the following properties: program (string, required) - path of the program to execute, usually specify process.execPath; arguments (string, required) - command line arguments when program is executed; title (string, required) - string displayed in JumpList; description (string, required) - description of the task; iconPath (string, required) - absolute path to icon file displayed in JumpList, can be arbitrary resource file, usually specify process.execPath to show program icon; iconIndex (number, required) - icon index in icon file, set to identify which icon if file contains multiple icons, or 0 if file contains one icon; workingDirectory (string, optional) - working directory with default empty.

traceOptions syntax and allowed values

The traceOptions property is a string that controls what kind of tracing is enabled. It is a comma-delimited sequence of strings chosen from: record-until-full, record-continuously, trace-to-console, enable-sampling, enable-systrace. Example: 'record-until-full,enable-sampling'.

TraceCategoriesAndOptions object structure

The TraceCategoriesAndOptions object has two properties: categoryFilter (string) and traceOptions (string). The categoryFilter controls what category groups should be traced. The traceOptions controls what kind of tracing is enabled.

categoryFilter syntax and behavior

The categoryFilter property is a string that controls what category groups should be traced. It can have an optional '-' prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples of valid filters are: test_MyTest*, test_MyTest*,test_OtherStuff, -excluded_category1,-excluded_category2.

traceOptions recording modes are mutually exclusive

The first 3 trace options (record-until-full, record-continuously, trace-to-console) are trace recording modes and are mutually exclusive. If more than one trace recording mode appears in the traceOptions string, the last one takes precedence.

traceOptions default recording mode

If none of the trace recording modes (record-until-full, record-continuously, trace-to-console) are specified in traceOptions, the default recording mode is record-until-full.

traceOptions default values

Before options parsed from traceOptions are applied, the trace option is first reset to default values: record_mode set to record-until-full, enable_sampling set to false, and enable_systrace set to false.

TraceConfig object structure and properties

TraceConfig is an object with the following optional properties: recording_mode (string, defaults to 'record-until-full'), trace_buffer_size_in_kb (number, defaults to 100MB), trace_buffer_size_in_events (number), enable_argument_filter (boolean), included_categories (string array), excluded_categories (string array), included_process_ids (number array), histogram_names (string array), and memory_dump_config (Record<string, any>).

Chrome DevTools matching TraceConfig example

A TraceConfig example that roughly matches what Chrome DevTools records: ```js { recording_mode: 'record-until-full', included_categories: [ 'devtools.timeline', 'disabled-by-default-devtools.timeline', 'disabled-by-default-devtools.timeline.frame', 'disabled-by-default-devtools.timeline.stack', 'v8.execute', 'blink.console', 'blink.user_timing', 'latencyInfo', 'disabled-by-default-v8.cpu_profiler', 'disabled-by-default-v8.cpu_profiler.hires' ], excluded_categories: ['*'] } ```

UploadData Object structure

The UploadData object has the following fields: bytes (Buffer, required) contains content being sent; file (string, optional) is the path of file being uploaded; blobUUID (string, optional) is the UUID of blob data which can be retrieved using the ses.getBlobData method.

UploadFile object structure

The UploadFile object contains the following fields: type (string, value 'file'), filePath (string, required), offset (integer, optional, defaults to 0), length (integer, optional, number of bytes to read from offset, defaults to 0), and modificationTime (double, optional, last modification time in seconds since UNIX epoch, defaults to 0).

UploadRawData object structure

The UploadRawData object has two properties: type (string, value 'rawData') and bytes (Buffer containing the data to be uploaded).

UserDefaultTypes structure fields and their types

UserDefaultTypes is a helper alias with the following field mappings: string maps to string type, boolean maps to boolean type, integer maps to number type, float maps to number type, double maps to number type, url maps to string type, array maps to Array<unknown> type, and dictionary maps to Record<string, unknown> type.

UserDefaultTypes is a helper alias only

UserDefaultTypes is a type helper alias. No object will ever actually exist of this type.

WebSource object structure

The WebSource object has two properties: code (string, required) and url (string, optional).

WebAuthnAccount credentialId field

The credentialId field is a required string containing a URL-safe base64-encoded credential ID with no padding. It matches the PublicKeyCredential.id value returned by navigator.credentials.get() in the renderer process.

WebAuthnAccount object structure

The WebAuthnAccount object represents a discoverable WebAuthn credential with the following fields: credentialId (required, string), userHandle (optional, string), name (optional, string), and displayName (optional, string).

WebAuthnAccount userHandle field

The userHandle field is an optional string containing a URL-safe base64-encoded user handle (user.id) that was provided when the credential was originally created.

WebAuthnAccount name field

The name field is an optional string providing a human-palatable identifier for the account, such as an email address or username.

WebAuthnAccount displayName field

The displayName field is an optional string providing a human-palatable name for the account that is intended for display purposes.

WindowOpenHandlerResponse object structure

The WindowOpenHandlerResponse object controls how new windows are created in response to window.open() calls. It has the following properties: action (string, required) which can be 'allow' or 'deny' to control whether a new window should be created; overrideBrowserWindowOptions (BrowserWindowConstructorOptions, optional) which allows customization of the created window; outlivesOpener (boolean, optional) which when set to true prevents the opened window from closing when its opener is closed (by default child windows close when their opener closes); and createWindow (function, optional) which if specified will be called instead of new BrowserWindow to create the child window, and the 'did-create-window' event will not be emitted.

WindowSessionEndEvent Object structure and properties

WindowSessionEndEvent Object extends Event. It has a 'reasons' property which is a string array listing reasons for shutdown. Possible values in the reasons array are 'shutdown', 'close-app', 'critical', or 'logoff'.

TouchBarLabel constructor options

The TouchBarLabel constructor accepts an options object with the following properties: label (string, optional) - text to display; accessibilityLabel (string, optional) - a short description of the button for use by screenreaders like VoiceOver; textColor (string, optional) - hex color of text, e.g. #ABCDEF.

TouchBarPopover constructor options

The TouchBarPopover constructor takes an options object with the following properties: label (string, optional) for popover button text; icon (NativeImage, optional) for popover button icon; items (TouchBar, required) for items to display in the popover; showCloseButton (boolean, optional, defaults to true) to display a close button on the left of the popover.

TouchBarScrubber main process only

TouchBarScrubber is available only in the main process. It is not exported from the 'electron' module and is only available as a return value of other methods in the Electron API.

View class cannot be subclassed

Electron's built-in View class cannot be subclassed in user code.

Xcode incompatible architecture error on arm64 macOS

If building on arm64 macOS and encountering 'incompatible architecture' errors from libxcrun, the build script may be pointing to Xcode 11.x.y which does not support arm64. Navigate to /Users/<user>/.electron_build_tools/third_party/Xcode/ and rename Xcode-13.3.0.app to Xcode.app to use the correct arm64-compatible Xcode version.

macOS build prerequisites

To build Electron on macOS, you need: macOS >= 12, Xcode (exact version depends on branch being built, latest version recommended for main branch), Python >= 3.9, and Node.js >= 22.12.0.

Arm64-specific build prerequisites

When building Electron on arm64 macOS machines, Rosetta 2 should be installed to support dependencies that need to cross-compile between x64 and arm64. Rosetta can be installed using the command: softwareupdate --install-rosetta.

Certificate verification failure during macOS build

SSL certificate verification errors during build may occur because Python 3.6+ uses its own copy of OpenSSL instead of Apple-supplied libraries. Installing the certifi package adds a curated bundle of default root certificates and resolves this issue.

TypeScript imports from electron/main

For better type checking when writing TypeScript code, you can import main process modules from 'electron/main' instead of 'electron'. Example: const { app, BrowserWindow } = require('electron/main')

ESM support in Electron

ECMAScript modules (using import to load a module) are supported in Electron as of Electron 28. More information about ESM support and how to use it is available in the ESM guide.

Module capitalization convention in Electron

Electron follows JavaScript conventions where PascalCase modules are instantiable class constructors (e.g. BrowserWindow, Tray, Notification) and camelCase modules are not instantiable (e.g. app, ipcRenderer, webContents).

Give your agent this brain