Move console.warn inside the helper method.
This commit is contained in:
parent
f6410d3b77
commit
ddedcf22d1
1 changed files with 13 additions and 14 deletions
|
@ -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.` +
|
let message = `Attempting to call a function in a renderer window that has been closed or released.` +
|
||||||
`\nFunction provided here: ${meta.location}`
|
`\nFunction provided here: ${meta.location}`
|
||||||
|
|
||||||
if (args.length === 0) return message
|
if (args.length > 0 && args[0].sender && args[0].sender.eventNames) {
|
||||||
if (!args[0].sender || !args[0].sender.eventNames) return message
|
|
||||||
|
|
||||||
const sender = args[0].sender
|
const sender = args[0].sender
|
||||||
const remoteEvents = sender.eventNames().filter((eventName) => {
|
const remoteEvents = sender.eventNames().filter((eventName) => {
|
||||||
return sender.listeners(eventName).includes(callIntoRenderer)
|
return sender.listeners(eventName).includes(callIntoRenderer)
|
||||||
|
@ -164,8 +162,9 @@ const removeRemoteListenersAndLogWarning = (meta, args, callIntoRenderer) => {
|
||||||
sender.removeListener(eventName, callIntoRenderer)
|
sender.removeListener(eventName, callIntoRenderer)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return message
|
console.warn(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert array of meta data from renderer into array of real values.
|
// 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()) {
|
if (!sender.isDestroyed() && webContentsId === sender.getId()) {
|
||||||
sender.send('ELECTRON_RENDERER_CALLBACK', meta.id, valueToMeta(sender, args))
|
sender.send('ELECTRON_RENDERER_CALLBACK', meta.id, valueToMeta(sender, args))
|
||||||
} else {
|
} else {
|
||||||
console.warn(removeRemoteListenersAndLogWarning(meta, args, callIntoRenderer))
|
removeRemoteListenersAndLogWarning(meta, args, callIntoRenderer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue