diff options
Diffstat (limited to 'localwebsite/htdocs/assets/modem.js')
-rw-r--r-- | localwebsite/htdocs/assets/modem.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/localwebsite/htdocs/assets/modem.js b/localwebsite/htdocs/assets/modem.js new file mode 100644 index 0000000..2ea4264 --- /dev/null +++ b/localwebsite/htdocs/assets/modem.js @@ -0,0 +1,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 + }); + }, +});
\ No newline at end of file |