aboutsummaryrefslogtreecommitdiff
path: root/companion
diff options
context:
space:
mode:
authorGravatar Jon Barlow <jon.barlow@fitbit.com> 2017-08-24 15:05:51 +0100
committerGravatar Jon Barlow <jon.barlow@fitbit.com> 2017-08-24 15:05:51 +0100
commit8a8a331096d0399f77bbac665e2523cf994353d3 (patch)
tree056417b68534c9787b23b42eee23a9f35ded010d /companion
parentb20803d82026aaa15e69ef2f62a025f5fcae33f1 (diff)
Initial
Diffstat (limited to 'companion')
-rw-r--r--companion/index.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/companion/index.js b/companion/index.js
new file mode 100644
index 0000000..963fd09
--- /dev/null
+++ b/companion/index.js
@@ -0,0 +1,12 @@
+import { settingsStorage } from "settings";
+import * as messaging from "messaging";
+
+settingsStorage.onchange = function(evt) {
+ if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {
+ let data = JSON.parse(evt.newValue);
+ messaging.peerSocket.send(data["values"][0].value);
+ } else {
+ console.log("companion - no connection");
+ }
+}
+