diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-05-21 01:45:56 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-05-21 01:45:56 +0300 |
commit | 6f53e6e997c9f4647a667bd58b11bc622fa3b47f (patch) | |
tree | 226bd65a04576de4f41bf8396af97cd43ca27829 /localwebsite/htdocs/assets/modem.js | |
parent | 902a3bfbe2c4645e6725fb7583500d1a28026fad (diff) |
move local website to homekit's tree
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 |