mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Destructure params directly
This commit is contained in:
@@ -124,12 +124,10 @@ let wrapWebContents = function(webContents) {
|
||||
};
|
||||
|
||||
// Dispatch IPC messages to the ipc module.
|
||||
webContents.on('ipc-message', function(event, packed) {
|
||||
const [channel, ...args] = packed;
|
||||
webContents.on('ipc-message', function(event, [channel, ...args]) {
|
||||
return ipcMain.emit.apply(ipcMain, [channel, event].concat(args));
|
||||
});
|
||||
webContents.on('ipc-message-sync', function(event, packed) {
|
||||
const [channel, ...args] = packed;
|
||||
webContents.on('ipc-message-sync', function(event, [channel, ...args]) {
|
||||
Object.defineProperty(event, 'returnValue', {
|
||||
set: function(value) {
|
||||
return event.sendReply(JSON.stringify(value));
|
||||
|
||||
@@ -146,8 +146,7 @@ var createGuest = function(embedder, params) {
|
||||
}
|
||||
|
||||
// Dispatch guest's IPC messages to embedder.
|
||||
guest.on('ipc-message-host', function(_, packed) {
|
||||
const [channel, ...args] = packed;
|
||||
guest.on('ipc-message-host', function(_, [channel, ...args]) {
|
||||
return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + guest.viewInstanceId, channel].concat(args));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user