add new webui module

This commit is contained in:
Stewart Allen 2021-12-29 12:55:45 -05:00
commit fa65c7c67f
3 changed files with 27 additions and 22 deletions

View file

@ -6,7 +6,9 @@
if (gapp.broker) return;
class Broker {
gapp.register('moto.broker');
gapp.broker = new class Broker {
constructor() {
this.topics = {};
this.used = {};
@ -91,7 +93,4 @@ class Broker {
}
}
gapp.broker = new Broker();
gapp.register('moto.broker');
})();

23
src/moto/webui.js Normal file
View file

@ -0,0 +1,23 @@
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
"use strict";
gapp.register('moto.webui');
// some ui helpers that need to go into a ui class
function $(id) {
return document.getElementById(id);
}
function $d(id, v) {
$(id).style.display = v;
}
function $h(id, h) {
$(id).innerHTML = h;
}
function estop(evt) {
evt.stopPropagation();
evt.preventDefault();
}