-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.mjs
53 lines (43 loc) · 1 KB
/
index.mjs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
`use strict`
//import {EventEmitter} from 'node:events';
import {EventEmitter} from './EventEmitter.js';
import './browser.js';
import exports from './lgtv.js';
const {
connect,
open_connection,
get_status,
sw_info,
input_media_play,
input_media_stop,
input_media_pause,
input_media_rewind,
input_media_forward,
apps,
start_app,
close_app,
input_pause,
input_play,
input_volumedown,
input_volumeup,
input_enter,
} = exports;
let port = 3000;
let host = `ws://192.168.15.128:` + port; // `ws://lg-tv.lan`
let hostTest = `ws://localhost:` + port; // `ws://lg-tv.lan`
let options = {
deviceIp: host,
// deviceIp: hostTest,
};
async function main() {
chrome.storage.local.set("options", options);
let err = function(key, value) {
console.log(key, value);
};
await connect(options.deviceIp, exports.get_status);
//chrome.storage.local.get("options");
await sw_info(exports.get_status);
chrome.storage.local.get("options", options);
}
await main();
process.exit(0);