L I N T I N G
This commit is contained in:
parent
26e3ad3c2e
commit
49c6446267
1 changed files with 8 additions and 8 deletions
|
@ -148,24 +148,24 @@ const throwRPCError = function (message) {
|
|||
|
||||
const rendererMissingErrorMessage = function (meta, args, callIntoRenderer) {
|
||||
let message = `Attempting to call a function in a renderer window that has been closed or released.` +
|
||||
`Function provided here: ${meta.location}.`;
|
||||
`\nFunction provided here: ${meta.location}`
|
||||
|
||||
if (!args || args.length === 0) return message;
|
||||
if (!args[0].sender || !args[0].sender._events) return message;
|
||||
if (!args || args.length === 0) return message
|
||||
if (!args[0].sender || !args[0].sender._events) return message
|
||||
|
||||
const eventsAttached = args[0].sender._events;
|
||||
const eventsAttached = args[0].sender._events
|
||||
const remoteEvents = Object.keys(eventsAttached).filter((eventName) => {
|
||||
return Array.isArray(eventsAttached[eventName]) ?
|
||||
eventsAttached[eventName].includes(callIntoRenderer) :
|
||||
eventsAttached[eventName] === callIntoRenderer
|
||||
});
|
||||
})
|
||||
|
||||
if (remoteEvents && remoteEvents.length > 0) {
|
||||
message += `\nRemote event names:`
|
||||
remoteEvents.forEach((eventName) => message += ` ${eventName} `);
|
||||
remoteEvents.forEach((eventName) => message += ` ${eventName} `)
|
||||
}
|
||||
|
||||
return message;
|
||||
return message
|
||||
}
|
||||
|
||||
// Convert array of meta data from renderer into array of real values.
|
||||
|
@ -218,7 +218,7 @@ const unwrapArgs = function (sender, args) {
|
|||
if (!sender.isDestroyed() && webContentsId === sender.getId()) {
|
||||
sender.send('ELECTRON_RENDERER_CALLBACK', meta.id, valueToMeta(sender, args))
|
||||
} else {
|
||||
throw new Error(rendererMissingErrorMessage(meta, args, callIntoRenderer));
|
||||
throw new Error(rendererMissingErrorMessage(meta, args, callIntoRenderer))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue