summaryrefslogtreecommitdiffstats
path: root/src/js/network.js
diff options
context:
space:
mode:
authorHumberto Alfonso Díaz <humberto.alfonso@asvito.es>2019-10-08 14:23:41 +0200
committerLorenzo Tilve <ltilve@igalia.com>2020-02-04 19:12:47 +0100
commit8550205a77b07234c356ea9d0fa3c486fb0e042a (patch)
tree150132fc164d00266194b33ff8627174c428a9f2 /src/js/network.js
parent168f29231cd8fa3b3c8f69f287c9523e67af0ef9 (diff)
FUNCT Add network status integration
Diffstat (limited to 'src/js/network.js')
-rw-r--r--src/js/network.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/js/network.js b/src/js/network.js
new file mode 100644
index 0000000..bb60a1d
--- /dev/null
+++ b/src/js/network.js
@@ -0,0 +1,29 @@
+import { network } from 'agl-js-api';
+import Mustache from 'mustache';
+
+var configjson = require('../config.json');
+var template;
+
+function render_network_item(networkItem) {
+ document.getElementById('networkStatusContainer').innerHTML += Mustache.render(template, networkItem);
+}
+
+function load_network_state() {
+ network.technologies().then(function(result) {
+ result.values.forEach(function(networkItem) {
+ networkItem.icon = configjson.network[networkItem.technology];
+ render_network_item(networkItem);
+ });
+ });
+
+}
+
+export function init() {
+ template = document.getElementById('network-status-template').innerHTML;
+ Mustache.parse(template);
+ load_network_state();
+
+ network.on_global_state(function(result) {
+ console.log('GLOBAL SATATE', result);
+ });
+} \ No newline at end of file