initial commit
This commit is contained in:
43
companion/index.js
Normal file
43
companion/index.js
Normal file
@@ -0,0 +1,43 @@
|
||||
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 'mincolor':
|
||||
case 'hrcolor':
|
||||
data = {
|
||||
key: evt.key,
|
||||
newValue: JSON.parse(evt.newValue)
|
||||
};
|
||||
break;
|
||||
case 'date':
|
||||
data = {
|
||||
key: evt.key,
|
||||
newValue: (evt.newValue === 'true')
|
||||
};
|
||||
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