aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/app.js
blob: 458a5d41a4fde13965c8996fa12c4b27e65a70ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import * as bluetooth from './bluetooth';
import { init as init_wifi } from './wifi';
import { load as load_template } from './templates';
import Mustache from 'mustache';

var template;
var page = {
    bluetooth: true,
    wifi: false
};

export function show() {
    page.bluetooth = bluetooth.getState();
    document.body.innerHTML = Mustache.render(template, page);
}

export function init() {
    load_template('main.template.html').then(function(result) {
        template = result;
        Mustache.parse(template);
        show();
        bluetooth.init();
    }, function(error) {
        console.error('ERRROR loading main template', error);
    });
}