From fa65c7c67fb70594c774cfc03e4ff38a0d0145d6 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 29 Dec 2021 12:55:45 -0500 Subject: [PATCH] add new webui module --- src/main/mesh.js | 19 +------------------ src/moto/broker.js | 7 +++---- src/moto/webui.js | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 src/moto/webui.js diff --git a/src/main/mesh.js b/src/main/mesh.js index fabeee19..b5e90a91 100644 --- a/src/main/mesh.js +++ b/src/main/mesh.js @@ -2,24 +2,6 @@ "use strict"; -// 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(); -} - (function() { let broker = gapp.broker; @@ -117,6 +99,7 @@ document.onreadystatechange = function() { // finalize modules gapp.finalize("main.mesh", [ + "moto.webui", // dep: moto.webui "moto.client", // dep: moto.client "moto.broker", // dep: moto.broker "moto.space" // dep: moto.space diff --git a/src/moto/broker.js b/src/moto/broker.js index df12244d..f1222e12 100644 --- a/src/moto/broker.js +++ b/src/moto/broker.js @@ -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'); - })(); diff --git a/src/moto/webui.js b/src/moto/webui.js new file mode 100644 index 00000000..548f380e --- /dev/null +++ b/src/moto/webui.js @@ -0,0 +1,23 @@ +/** Copyright Stewart Allen -- 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(); +}