-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
30 lines (24 loc) · 831 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const portfinder = require('portfinder');
const electron = require('electron');
const open = require('open');
const { Display } = require('@caption/display');
const { Transcripter } = require('@caption/transcripter');
async function run() {
const port = await portfinder.getPortPromise();
const display = new Display(electron);
const transcripter = new Transcripter(port);
transcripter.on('connected', function (address) {
display.intro(`Opening ${address} on Google Chrome.`);
open(address, { app: {name: open.apps.chrome} });
});
transcripter.on('message', function (message) {
display.write(message);
});
display.on('close', async function () {
transcripter.close();
});
display.on('load', function () {
transcripter.start();
});
}
run();