fix: screen EventEmitter methods with remote (#26989)

This commit is contained in:
Shelley Vohr
2020-12-14 10:39:43 -08:00
committed by GitHub
parent c4e8c0fd0e
commit 0e0a1421fd

View File

@@ -1,3 +1,4 @@
import { EventEmitter } from 'events';
const { createScreen } = process._linkedBinding('electron_common_screen');
let _screen: Electron.Screen;
@@ -36,5 +37,11 @@ export default new Proxy({}, {
getOwnPropertyDescriptor: (target, property: string) => {
createScreenIfNeeded();
return Reflect.getOwnPropertyDescriptor(_screen, property);
},
getPrototypeOf: () => {
// This is necessary as a result of weirdness with EventEmitterMixin
// and FunctionTemplate - we need to explicitly ensure it's returned
// in the prototype.
return EventEmitter.prototype;
}
});