asarfuckery/electronasar/ptb/renderer/api/ipc-renderer.js

23 lines
835 B
JavaScript
Raw Normal View History

2019-10-01 13:49:56 +00:00
'use strict';
const { ipc } = process.electronBinding('ipc');
const v8Util = process.electronBinding('v8_util');
2019-01-17 18:22:05 +00:00
// Created by init.js.
2019-10-01 13:49:56 +00:00
const ipcRenderer = v8Util.getHiddenValue(global, 'ipc');
const internal = false;
ipcRenderer.send = function (channel, ...args) {
return ipc.send(internal, channel, args);
};
ipcRenderer.sendSync = function (channel, ...args) {
return ipc.sendSync(internal, channel, args)[0];
};
ipcRenderer.sendToHost = function (channel, ...args) {
return ipc.sendToHost(channel, args);
};
2019-01-17 18:22:05 +00:00
ipcRenderer.sendTo = function (webContentsId, channel, ...args) {
2019-10-01 13:49:56 +00:00
return ipc.sendTo(internal, false, webContentsId, channel, args);
};
2019-01-17 18:22:05 +00:00
ipcRenderer.sendToAll = function (webContentsId, channel, ...args) {
2019-10-01 13:49:56 +00:00
return ipc.sendTo(internal, true, webContentsId, channel, args);
};
module.exports = ipcRenderer;