Merge branch 'support-chromium-sandbox' of https://github.com/tarruda/electron into tarruda-support-chromium-sandbox
This commit is contained in:
commit
458c4dd129
35 changed files with 1055 additions and 100 deletions
29
lib/renderer/api/ipc-renderer-setup.js
Normal file
29
lib/renderer/api/ipc-renderer-setup.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
module.exports = function (ipcRenderer, binding) {
|
||||
ipcRenderer.send = function (...args) {
|
||||
return binding.send('ipc-message', args)
|
||||
}
|
||||
|
||||
ipcRenderer.sendSync = function (...args) {
|
||||
return JSON.parse(binding.sendSync('ipc-message-sync', args))
|
||||
}
|
||||
|
||||
ipcRenderer.sendToHost = function (...args) {
|
||||
return binding.send('ipc-message-host', args)
|
||||
}
|
||||
|
||||
ipcRenderer.sendTo = function (webContentsId, channel, ...args) {
|
||||
if (typeof webContentsId !== 'number') {
|
||||
throw new TypeError('First argument has to be webContentsId')
|
||||
}
|
||||
|
||||
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', false, webContentsId, channel, ...args)
|
||||
}
|
||||
|
||||
ipcRenderer.sendToAll = function (webContentsId, channel, ...args) {
|
||||
if (typeof webContentsId !== 'number') {
|
||||
throw new TypeError('First argument has to be webContentsId')
|
||||
}
|
||||
|
||||
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', true, webContentsId, channel, ...args)
|
||||
}
|
||||
}
|
|
@ -5,33 +5,6 @@ const v8Util = process.atomBinding('v8_util')
|
|||
|
||||
// Created by init.js.
|
||||
const ipcRenderer = v8Util.getHiddenValue(global, 'ipc')
|
||||
|
||||
ipcRenderer.send = function (...args) {
|
||||
return binding.send('ipc-message', args)
|
||||
}
|
||||
|
||||
ipcRenderer.sendSync = function (...args) {
|
||||
return JSON.parse(binding.sendSync('ipc-message-sync', args))
|
||||
}
|
||||
|
||||
ipcRenderer.sendToHost = function (...args) {
|
||||
return binding.send('ipc-message-host', args)
|
||||
}
|
||||
|
||||
ipcRenderer.sendTo = function (webContentsId, channel, ...args) {
|
||||
if (typeof webContentsId !== 'number') {
|
||||
throw new TypeError('First argument has to be webContentsId')
|
||||
}
|
||||
|
||||
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', false, webContentsId, channel, ...args)
|
||||
}
|
||||
|
||||
ipcRenderer.sendToAll = function (webContentsId, channel, ...args) {
|
||||
if (typeof webContentsId !== 'number') {
|
||||
throw new TypeError('First argument has to be webContentsId')
|
||||
}
|
||||
|
||||
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', true, webContentsId, channel, ...args)
|
||||
}
|
||||
require('./ipc-renderer-setup')(ipcRenderer, binding)
|
||||
|
||||
module.exports = ipcRenderer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue