electron/spec/fixtures/module/preload-ipc-ping-pong.js
Milan Burda 3df6d337f3
feat: add senderIsMainFrame to messages sent via ipcRenderer.sendTo() (#38868)
* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame
2023-07-24 14:27:30 +02:00

9 lines
328 B
JavaScript

const { ipcRenderer } = require('electron');
ipcRenderer.on('ping', function ({ senderId, senderIsMainFrame }, payload) {
ipcRenderer.sendTo(senderId, 'pong', { payload, senderIsMainFrame });
});
ipcRenderer.on('ping-æøåü', function (event, payload) {
ipcRenderer.sendTo(event.senderId, 'pong-æøåü', payload);
});