optsobjectexcludeSelfboolean - exclude send ipc message to main process when callingipcPlusR.sendToAll.
Ipc option used in ipcPlusR.sendToAll and ipcPlusR.sendToWins.
messagestring - Ipc message....args... - Whatever arguments the message needs.optionobject - You can indicate the last argument as an IPC option byipcPlusR.option({...}).
Send message with ...args to all opened window and to main process asynchronously.
NOTE
This is a broadcast method, it will not recieve callback.
messagestring - Ipc message....args... - Whatever arguments the message needs.optionobject - You can indicate the last argument as an IPC option byipcPlusR.option({...}).
Send message with ...args to all opened windows asynchronously. The renderer process can handle it by listening to the message through the electron.ipcRenderer or ipcPlus module.
NOTE
This is a broadcast method, it will not recieve callback.
Example:
Send IPC message (renderer process)
const ipcPlusR = require('electron-ipc-plus');
ipcPlusR.sendToWins('foobar:say-hello', 'Hello World!');messagestring - Ipc message....args... - Whatever arguments the message needs.
Returns ...: Whatever returns from main process.
Send message with ...args to main process synchronously. (This is same as electron.ipcRenderer.sendSync).
messagestring - Ipc message....args... - Whatever arguments the message needs.callbackfunction - You can specify a callback function to receive IPC reply at the last or the 2nd last argument.timeoutnumber - You can specify a timeout for the callback at the last argument. If no timeout specified, it will be 5000ms.
Returns number - If we have callback function, a session ID will returned.
Example:
Send IPC message (renderer process)
const ipcPlusR = require('electron-ipc-plus');
ipcPlusR.sendToMain('foobar:say-hello', (err, msg) => {
if ( err && err.code === 'ETIMEOUT' ) {
console.error('Timeout for ipc message foobar:say-hello');
return;
}
console.log(`foobar replied: ${msg}`);
});Receive and Reply IPC message (main process)
const {ipcRenderer} = require('electron');
ipcRenderer.on('foobar:say-hello', event => {
event.reply(null, 'Hi');
});sessionIdnumber - The session ID.
Cancel request sent to main process via ipcPlusR.sendToMain.
Turn on/off the debug information. No use in current version.