fix: make sure classes in lib correctly implement Electron interfaces (#40291)

This commit is contained in:
Milan Burda 2023-10-25 14:02:15 -04:00 committed by GitHub
parent 514a9319b9
commit f66d4c7ee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 21 additions and 17 deletions

View file

@ -1,10 +1,12 @@
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
import { EventEmitter } from 'events';
const { createPair } = process._linkedBinding('electron_browser_message_port');
export default class MessageChannelMain {
export default class MessageChannelMain extends EventEmitter implements Electron.MessageChannelMain {
port1: MessagePortMain;
port2: MessagePortMain;
constructor () {
super();
const { port1, port2 } = createPair();
this.port1 = new MessagePortMain(port1);
this.port2 = new MessagePortMain(port2);