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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue