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

ipc core methods

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

contents.send(channel, ...args) - send async message to renderer

Send an asynchronous message to the renderer process via channel, along with arguments. Arguments will be serialized with the Structured Clone Algorithm, just like postMessage, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception. Non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception. Parameters: channel (string), ...args (any[]).

contents.sendToFrame(frameId, channel, ...args) - send to specific frame

Send an asynchronous message to a specific frame in a renderer process via channel, along with arguments. Arguments will be serialized with the Structured Clone Algorithm, just like postMessage, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception. Non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception. Parameters: frameId (Integer or [number, number]) - the ID of the frame to send to, or a pair of [processId, frameId] if the frame is in a different process to the main frame, channel (string), ...args (any[]). The renderer process can handle the message by listening to channel with the ipcRenderer module. To get the frameId of a given renderer context, use webFrame.routingId. You can also read frameId from all incoming IPC messages in the main process.

sendToFrame() frameId retrieval

To get the frameId of a given renderer context, use require('electron').webFrame.routingId in the renderer process. In the main process, frameId can be read from all incoming IPC messages by accessing event.frameId.

contents.ipc property - scoped IPC main

An IpcMain scoped to just IPC messages sent from this WebContents. IPC messages sent with ipcRenderer.send, ipcRenderer.sendSync or ipcRenderer.postMessage will be delivered in the following order: 1) contents.on('ipc-message'), 2) contents.mainFrame.on(channel), 3) contents.ipc.on(channel), 4) ipcMain.on(channel). Handlers registered with invoke will be checked in the following order; the first one that is defined will be called, the rest will be ignored: 1) contents.mainFrame.handle(channel), 2) contents.handle(channel), 3) ipcMain.handle(channel). A handler or event listener registered on the WebContents will receive IPC messages sent from any frame, including child frames. In most cases, only the main frame can send IPC messages. However, if nodeIntegrationInSubFrames option is enabled, child frames can send IPC messages also; handlers should check the senderFrame property of the IPC event to ensure the message is coming from the expected frame.

Give your agent this brain