2020-03-12 01:07:54 +00:00
|
|
|
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
2023-10-25 18:02:15 +00:00
|
|
|
import { EventEmitter } from 'events';
|
2020-06-23 03:32:45 +00:00
|
|
|
const { createPair } = process._linkedBinding('electron_browser_message_port');
|
2020-03-12 01:07:54 +00:00
|
|
|
|
2023-10-25 18:02:15 +00:00
|
|
|
export default class MessageChannelMain extends EventEmitter implements Electron.MessageChannelMain {
|
2020-03-12 01:07:54 +00:00
|
|
|
port1: MessagePortMain;
|
|
|
|
port2: MessagePortMain;
|
|
|
|
constructor () {
|
2023-10-25 18:02:15 +00:00
|
|
|
super();
|
2020-03-12 01:07:54 +00:00
|
|
|
const { port1, port2 } = createPair();
|
|
|
|
this.port1 = new MessagePortMain(port1);
|
|
|
|
this.port2 = new MessagePortMain(port2);
|
|
|
|
}
|
|
|
|
}
|