Destructure params directly

This commit is contained in:
Kevin Sawicki 2016-03-21 11:03:18 -07:00
parent 43746727aa
commit 4127b524d5
2 changed files with 3 additions and 6 deletions

View file

@ -124,12 +124,10 @@ let wrapWebContents = function(webContents) {
}; };
// Dispatch IPC messages to the ipc module. // Dispatch IPC messages to the ipc module.
webContents.on('ipc-message', function(event, packed) { webContents.on('ipc-message', function(event, [channel, ...args]) {
const [channel, ...args] = packed;
return ipcMain.emit.apply(ipcMain, [channel, event].concat(args)); return ipcMain.emit.apply(ipcMain, [channel, event].concat(args));
}); });
webContents.on('ipc-message-sync', function(event, packed) { webContents.on('ipc-message-sync', function(event, [channel, ...args]) {
const [channel, ...args] = packed;
Object.defineProperty(event, 'returnValue', { Object.defineProperty(event, 'returnValue', {
set: function(value) { set: function(value) {
return event.sendReply(JSON.stringify(value)); return event.sendReply(JSON.stringify(value));

View file

@ -146,8 +146,7 @@ var createGuest = function(embedder, params) {
} }
// Dispatch guest's IPC messages to embedder. // Dispatch guest's IPC messages to embedder.
guest.on('ipc-message-host', function(_, packed) { guest.on('ipc-message-host', function(_, [channel, ...args]) {
const [channel, ...args] = packed;
return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + guest.viewInstanceId, channel].concat(args)); return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + guest.viewInstanceId, channel].concat(args));
}); });