Move console.warn inside the helper method.

This commit is contained in:
Charlie Hess 2017-01-18 16:09:46 -08:00 committed by Kevin Sawicki
parent f6410d3b77
commit ddedcf22d1

View file

@ -150,9 +150,7 @@ const removeRemoteListenersAndLogWarning = (meta, args, callIntoRenderer) => {
let message = `Attempting to call a function in a renderer window that has been closed or released.` +
`\nFunction provided here: ${meta.location}`
if (args.length === 0) return message
if (!args[0].sender || !args[0].sender.eventNames) return message
if (args.length > 0 && args[0].sender && args[0].sender.eventNames) {
const sender = args[0].sender
const remoteEvents = sender.eventNames().filter((eventName) => {
return sender.listeners(eventName).includes(callIntoRenderer)
@ -164,8 +162,9 @@ const removeRemoteListenersAndLogWarning = (meta, args, callIntoRenderer) => {
sender.removeListener(eventName, callIntoRenderer)
})
}
}
return message
console.warn(message)
}
// Convert array of meta data from renderer into array of real values.
@ -218,7 +217,7 @@ const unwrapArgs = function (sender, args) {
if (!sender.isDestroyed() && webContentsId === sender.getId()) {
sender.send('ELECTRON_RENDERER_CALLBACK', meta.id, valueToMeta(sender, args))
} else {
console.warn(removeRemoteListenersAndLogWarning(meta, args, callIntoRenderer))
removeRemoteListenersAndLogWarning(meta, args, callIntoRenderer)
}
}