aboutsummaryrefslogtreecommitdiff
path: root/localwebsite/htdocs/assets/modem.js
blob: 9fdb91d37a6989bc68b928332040acfdaf416e9a (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
27
28
29
var ModemStatus = {
    _modems: [],

    init: function(modems) {
        for (var i = 0; i < modems.length; i++) {
            var modem = modems[i];
            this._modems.push(new ModemStatusUpdater(modem));
        }
    }
};


function ModemStatusUpdater(id) {
    this.id = id;
    this.elem = ge('modem_data_'+id);
    this.fetch();
}
extend(ModemStatusUpdater.prototype, {
    fetch: function() {
        ajax.get('/modem/get.ajax', {
            id: this.id
        }).then(({response}) => {
            var {html} = response;
            this.elem.innerHTML = html;

            // TODO enqueue rerender
        });
    },
});