electron/lib/browser/api/message-channel.ts
Shelley Vohr 659e79fc08
refactor: prevent consistent early exception (#24191)
* refactor: prevent consistent early exception

* Use _linkedBinding where possible

* Remove dead electronBinding
2020-06-22 20:32:45 -07:00

12 lines
413 B
TypeScript

import { MessagePortMain } from '@electron/internal/browser/message-port-main';
const { createPair } = process._linkedBinding('electron_browser_message_port');
export default class MessageChannelMain {
port1: MessagePortMain;
port2: MessagePortMain;
constructor () {
const { port1, port2 } = createPair();
this.port1 = new MessagePortMain(port1);
this.port2 = new MessagePortMain(port2);
}
}