-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
controller.js
49 lines (40 loc) · 1.22 KB
/
controller.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* File: controller.js
* Project: discord-rpc
* File Created: Saturday, 4th February 2023 9:16:06 am
* Author: Tee ([email protected])
* Github: https://github.com/teeteeteeteetee
* Discord: Tee#0001
*
* Last Modified: Saturday, 25th November 2023 2:49:42 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
*/
import { setConfiguration } from "../rpc_client-src/localstorage";
// import { rpcConfiguration, extensionConfiguration, hasProp, getConfiguration, setConfiguration } from "./configuration";
const csInterface = new CSInterface();
class Controller {
constructor() {
this.init()
}
logz(log){
console.log("Controller:: " + log)
}
init(){
this.logz("Registering log event")
csInterface.addEventListener('com.tee.panel.logger', (e) => {
this.logz(e.data)
})
this.logz("Registering localstorage")
csInterface.addEventListener('com.tee.rpc.config', (e) => {
console.log(e.data)
Object.keys(e.data).forEach(k => {
setConfiguration(k, e.data[k])
})
this.logz(e.data)
})
}
}
new Controller()
export default Controller