diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/apps.js | 13 | ||||
-rw-r--r-- | src/js/main.js | 4 | ||||
-rw-r--r-- | src/js/network.js | 29 | ||||
-rw-r--r-- | src/js/weather.js | 5 |
4 files changed, 46 insertions, 5 deletions
diff --git a/src/js/apps.js b/src/js/apps.js index 73d926e..b9829ad 100644 --- a/src/js/apps.js +++ b/src/js/apps.js @@ -20,11 +20,14 @@ function load_application_list() { configjson.apps.forEach(function(app) { var internalApp = locateApp(app.id, result); - renderApp({ - id: internalApp.id, - name: internalApp.name, - icon: app.icon - }); + if( internalApp ) { + renderApp({ + id: internalApp.id, + name: internalApp.name, + icon: app.icon + }); + } + }); }); } diff --git a/src/js/main.js b/src/js/main.js index c68f572..d26f701 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1,5 +1,9 @@ import { init as init_apps } from './apps'; +import { init as init_weather } from './weather'; +import { init as init_network } from './network'; export function init() { init_apps(); + init_weather(); + init_network(); }
\ No newline at end of file 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 diff --git a/src/js/weather.js b/src/js/weather.js new file mode 100644 index 0000000..26c64b9 --- /dev/null +++ b/src/js/weather.js @@ -0,0 +1,5 @@ +import { weather } from 'agl-js-api'; + +export function init() { + console.log('TBD'); +}
\ No newline at end of file |