summaryrefslogtreecommitdiff
path: root/localwebsite/htdocs/assets/modem.js
blob: 2ea42644aac62130536b5f822ef1237ae4b8aec1 (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/status/get.ajax', {
            id: this.id
        }).then(({response}) => {
            var {html} = response;
            this.elem.innerHTML = html;

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