Use spread operator

This commit is contained in:
Kevin Sawicki 2016-11-03 11:37:18 -07:00
parent e4d6aa30a1
commit 0485069c7b
2 changed files with 3 additions and 3 deletions

View file

@ -68,7 +68,7 @@ module.exports = {
}) })
ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-${viewInstanceId}`, function (event, eventName, ...args) { ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-${viewInstanceId}`, function (event, eventName, ...args) {
dispatchEvent.apply(null, [webView, eventName, eventName].concat(args)) dispatchEvent(webView, eventName, eventName, ...args)
}) })
ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE-${viewInstanceId}`, function (event, channel, ...args) { ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE-${viewInstanceId}`, function (event, channel, ...args) {

View file

@ -396,7 +396,7 @@ var registerWebViewElement = function () {
return function (...args) { return function (...args) {
const internal = v8Util.getHiddenValue(this, 'internal') const internal = v8Util.getHiddenValue(this, 'internal')
if (internal.webContents) { if (internal.webContents) {
return internal.webContents[m].apply(internal.webContents, args) return internal.webContents[m](...args)
} else { } else {
throw new Error(`Cannot call ${m} because the webContents is unavailable. The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.`) throw new Error(`Cannot call ${m} because the webContents is unavailable. The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.`)
} }
@ -409,7 +409,7 @@ var registerWebViewElement = function () {
const createNonBlockHandler = function (m) { const createNonBlockHandler = function (m) {
return function (...args) { return function (...args) {
const internal = v8Util.getHiddenValue(this, 'internal') const internal = v8Util.getHiddenValue(this, 'internal')
ipcRenderer.send.apply(ipcRenderer, ['ELECTRON_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', null, internal.guestInstanceId, m].concat(args)) ipcRenderer.send('ELECTRON_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', null, internal.guestInstanceId, m, ...args)
} }
} }
for (const method of nonblockMethods) { for (const method of nonblockMethods) {