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

31 lines
806 B
JavaScript
Raw Normal View History

2019-02-06 20:27:58 +00:00
'use strict'
const binding = process.atomBinding('ipc')
const v8Util = process.atomBinding('v8_util')
// Created by init.js.
const ipcRenderer = v8Util.getHiddenValue(global, 'ipc')
const internal = false
ipcRenderer.send = function (...args) {
2019-04-05 18:06:38 +00:00
return binding.send('-ipc-message', args)
2019-02-06 20:27:58 +00:00
}
ipcRenderer.sendSync = function (...args) {
2019-04-05 18:06:38 +00:00
return binding.sendSync('-ipc-message-sync', args)[0]
2019-02-06 20:27:58 +00:00
}
ipcRenderer.sendToHost = function (...args) {
return binding.send('ipc-message-host', args)
}
ipcRenderer.sendTo = function (webContentsId, channel, ...args) {
return binding.sendTo(internal, false, webContentsId, channel, args)
}
ipcRenderer.sendToAll = function (webContentsId, channel, ...args) {
return binding.sendTo(internal, true, webContentsId, channel, args)
}
module.exports = ipcRenderer