initial commit
This commit is contained in:
36
companion/index.js
Normal file
36
companion/index.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import * as messaging from "messaging";
|
||||
import { settingsStorage } from "settings";
|
||||
|
||||
//console.log("Companion Started");
|
||||
|
||||
messaging.peerSocket.onopen = () => {
|
||||
};
|
||||
|
||||
messaging.peerSocket.close = () => {
|
||||
};
|
||||
|
||||
settingsStorage.onchange = evt => {
|
||||
let data = {}
|
||||
switch(evt.key) {
|
||||
case 'progresscolor':
|
||||
data = {
|
||||
key: evt.key,
|
||||
newValue: JSON.parse(evt.newValue).values[0].value
|
||||
};
|
||||
break;
|
||||
default:
|
||||
data = {
|
||||
key: evt.key,
|
||||
newValue: evt.newValue
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
sendVal(data);
|
||||
};
|
||||
|
||||
function sendVal(data) {
|
||||
if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {
|
||||
messaging.peerSocket.send(data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user