Skip to content

Commit

Permalink
fix: screen EventEmitter methods with remote (#26809)
Browse files Browse the repository at this point in the history
* fix: screen EventEmitter methods with remote

* Review feedback
  • Loading branch information
codebytere committed Dec 8, 2020
1 parent e870613 commit b788ceb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/browser/api/screen.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { EventEmitter } from 'events';

const { createScreen } = process._linkedBinding('electron_common_screen');

let _screen: Electron.Screen;
Expand Down Expand Up @@ -36,5 +38,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;
}
});

0 comments on commit b788ceb

Please sign in to comment.