Use destructuring assigment
This commit is contained in:
parent
baa566adae
commit
4f4dc2f4d8
3 changed files with 40 additions and 48 deletions
|
@ -9,7 +9,6 @@ const Menu = require('electron').Menu;
|
|||
const binding = process.atomBinding('web_contents');
|
||||
const debuggerBinding = process.atomBinding('debugger');
|
||||
|
||||
let slice = [].slice;
|
||||
let nextId = 0;
|
||||
|
||||
let getNextId = function() {
|
||||
|
@ -126,19 +125,17 @@ let wrapWebContents = function(webContents) {
|
|||
|
||||
// Dispatch IPC messages to the ipc module.
|
||||
webContents.on('ipc-message', function(event, packed) {
|
||||
var args, channel;
|
||||
channel = packed[0], args = 2 <= packed.length ? slice.call(packed, 1) : [];
|
||||
return ipcMain.emit.apply(ipcMain, [channel, event].concat(slice.call(args)));
|
||||
const [channel, ...args] = packed;
|
||||
return ipcMain.emit.apply(ipcMain, [channel, event].concat(args));
|
||||
});
|
||||
webContents.on('ipc-message-sync', function(event, packed) {
|
||||
var args, channel;
|
||||
channel = packed[0], args = 2 <= packed.length ? slice.call(packed, 1) : [];
|
||||
const [channel, ...args] = packed;
|
||||
Object.defineProperty(event, 'returnValue', {
|
||||
set: function(value) {
|
||||
return event.sendReply(JSON.stringify(value));
|
||||
}
|
||||
});
|
||||
return ipcMain.emit.apply(ipcMain, [channel, event].concat(slice.call(args)));
|
||||
return ipcMain.emit.apply(ipcMain, [channel, event].concat(args));
|
||||
});
|
||||
|
||||
// Handle context menu action request from pepper plugin.
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
const ipcMain = require('electron').ipcMain;
|
||||
const webContents = require('electron').webContents;
|
||||
|
||||
var slice = [].slice;
|
||||
|
||||
// Doesn't exist in early initialization.
|
||||
var webViewManager = null;
|
||||
|
||||
|
@ -149,9 +147,8 @@ var createGuest = function(embedder, params) {
|
|||
|
||||
// Dispatch guest's IPC messages to embedder.
|
||||
guest.on('ipc-message-host', function(_, packed) {
|
||||
var args, channel;
|
||||
channel = packed[0], args = 2 <= packed.length ? slice.call(packed, 1) : [];
|
||||
return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + guest.viewInstanceId, channel].concat(slice.call(args)));
|
||||
const [channel, ...args] = packed;
|
||||
return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + guest.viewInstanceId, channel].concat(args));
|
||||
});
|
||||
|
||||
// Autosize.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue