Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/main/api/screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ export type Size = {
};

/**
* `workArea` excludes the taskbar on Windows only; macOS and Linux report `bounds`. macOS also
* reports every display's origin as (0, 0), since CoreGraphics has no scalar origin getter.
* `scaleFactor` is the device-pixel ratio, `rotation` degrees clockwise.
* `workArea` excludes the menu bar and Dock on macOS and the taskbar on Windows; Linux reports
* `bounds`. `scaleFactor` is the device-pixel ratio, `rotation` degrees clockwise.
*/
export type Display = {
readonly id: number;
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/api/ipc-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ The router covers the everyday `on`/`once`/`handle` flow, but several Electron m
* **`ipcMain.off`, `ipcMain.addListener`** - these Electron aliases for `removeListener`/`on` do not exist. Use `removeListener` and `on` directly.
* **Synchronous IPC (`event.returnValue`)** - there is no synchronous `ipcRenderer.sendSync` path, so listeners cannot set `event.returnValue` to reply inline. Use `handle`/`invoke` for request/response instead.
* **`event.frameId` / `event.processId` / `event.senderFrame`** - frame and process routing metadata is not exposed; `event.sender` is all you get, and iframe-level addressing is not modeled.
* **`event.ports` and `MessagePort` transfer** - `MessagePortMain` / `postMessage` channels are not implemented; payloads cross as JSON, not structured clone. Functions, symbols and `bigint` are rejected on both sides, and the renderer side also rejects `Map`, `Set`, `ArrayBuffer` and typed arrays rather than letting JSON mangle them.
* **`event.ports` and `MessagePort` transfer** - `MessagePortMain` / `postMessage` channels are not implemented; payloads cross as JSON, not structured clone. A `Map`, `Set`, `ArrayBuffer`, typed array, function, symbol or `bigint` is refused on both sides rather than arriving mangled: the preload throws a `TypeError`, and main throws an `InvalidArgumentError` (a handler that returns one makes the page's `invoke` reject). A Node `Buffer` sent from main arrives as `{ type: 'Buffer', data: [...] }`.
* **`EventEmitter` surface** - because `ipcMain` is not an `EventEmitter`, methods like `eventNames()`, `listenerCount()`, `setMaxListeners()`, and `prependListener()` are unavailable.
* **Full-fidelity error propagation** - `handle` errors are flattened to the `message` string only; stack traces and custom error properties are lost across the boundary (the same limitation Electron documents, noted here for parity).

Expand Down
4 changes: 2 additions & 2 deletions website/src/content/docs/api/web-contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ win.webContents.sendInputEvent({ type: 'keyDown', keyCode: 'Enter' });
win.webContents.sendInputEvent({ type: 'keyUp', keyCode: 'Enter' });
```

Honest follow-up limits: there are no keyboard modifiers yet, synthesized drags don't carry button state, and `KeyboardEvent.code` / scan codes and the F1-F24 keys are not wired.
Limits on Windows today: there are no modifier keys, so a `modifiers` array is ignored and Shift, Ctrl and Alt come from the physical keyboard. `keyDown` and `keyUp` know letters, digits, Enter, Tab, Escape, Backspace, Space, Delete, the arrows, Home, End, PageUp and PageDown; any other key, F1-F24 included, does nothing (`char` types any single character). Coordinates are only guaranteed at 100% display scaling. See the [parity page](/docs/migrating/parity#webcontentssendinputevent) for the full list.

### `contents.setWindowOpenHandler(handler)`

Expand Down Expand Up @@ -309,7 +309,7 @@ if (!win.webContents.isDestroyed()) {
* `channel` string
* `...args` any[]

Sends an event on `channel` to the renderer, where `ipcRenderer.on(channel, ...)` in the preload receives it. Arguments are **JSON**-serialized, not structured-cloned as in Electron: a function, symbol or `bigint` throws `InvalidArgumentError`, a `Date` arrives as a string, `Map` / `Set` / typed arrays arrive as plain objects, and `undefined` properties vanish. Send plain data. A `send` before the page's first load is queued on all platforms and flushed once the bridge is up - at `dom-ready` on Linux and Windows, at `did-finish-load` on macOS - so a message fired right after `loadFile` is not lost.
Sends an event on `channel` to the renderer, where `ipcRenderer.on(channel, ...)` in the preload receives it. Arguments are **JSON**-serialized, not structured-cloned as in Electron: a `Map`, `Set`, `ArrayBuffer`, typed array, function, symbol or `bigint` throws `InvalidArgumentError`, a `Date` arrives as a string, a Node `Buffer` arrives as `{ type: 'Buffer', data: [...] }`, and `undefined` properties vanish. Send plain data. A `send` before the page's first load is queued on all platforms and flushed once the bridge is up - at `dom-ready` on Linux and Windows, at `did-finish-load` on macOS - so a message fired right after `loadFile` is not lost.

```ts
win.webContents.send('update-available', { version: '1.2.0' });
Expand Down
Loading
Loading