fix: screen EventEmitter methods with remote (#26809)
* fix: screen EventEmitter methods with remote * Review feedback
This commit is contained in:
parent
e87061398b
commit
b788ceb7bd
1 changed files with 8 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
const { createScreen } = process._linkedBinding('electron_common_screen');
|
const { createScreen } = process._linkedBinding('electron_common_screen');
|
||||||
|
|
||||||
let _screen: Electron.Screen;
|
let _screen: Electron.Screen;
|
||||||
|
@ -36,5 +38,11 @@ export default new Proxy({}, {
|
||||||
getOwnPropertyDescriptor: (target, property: string) => {
|
getOwnPropertyDescriptor: (target, property: string) => {
|
||||||
createScreenIfNeeded();
|
createScreenIfNeeded();
|
||||||
return Reflect.getOwnPropertyDescriptor(_screen, property);
|
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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue