replace isEventEmitter with instanceof EventEmitter (rpc-server) (#12998)
This commit is contained in:
parent
8b2bffcf9e
commit
7c19ae302e
1 changed files with 1 additions and 7 deletions
|
@ -147,17 +147,11 @@ const throwRPCError = function (message) {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
|
||||||
const isEventEmitter = (object) => {
|
|
||||||
if (!object) return false
|
|
||||||
const prototype = Object.getPrototypeOf(object)
|
|
||||||
return prototype === EventEmitter.prototype || isEventEmitter(prototype)
|
|
||||||
}
|
|
||||||
|
|
||||||
const removeRemoteListenersAndLogWarning = (sender, meta, callIntoRenderer) => {
|
const removeRemoteListenersAndLogWarning = (sender, meta, 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 (isEventEmitter(sender)) {
|
if (sender instanceof EventEmitter) {
|
||||||
const remoteEvents = sender.eventNames().filter((eventName) => {
|
const remoteEvents = sender.eventNames().filter((eventName) => {
|
||||||
return sender.listeners(eventName).includes(callIntoRenderer)
|
return sender.listeners(eventName).includes(callIntoRenderer)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue