From 4127b524d577059716f9f4b12cd5c8bc6ed60474 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Mar 2016 11:03:18 -0700 Subject: [PATCH] Destructure params directly --- lib/browser/api/web-contents.js | 6 ++---- lib/browser/guest-view-manager.js | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index b8e58df379e9..1e0e83f7b058 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -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)); diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index 2fcd3f987f1b..1c1d6f9cfd00 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -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)); });