summaryrefslogtreecommitdiff
path: root/src/UI.js
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-04-15 21:10:01 -0400
committerLLLL Colonq <llll@colonq>2025-04-15 21:10:01 -0400
commitb31fd7881f8da11dbdd1cc259907b535d96a47a4 (patch)
tree1829fe570e53a0876990c6056da6f71880b65493 /src/UI.js
parentbd1256504b6154c7d9b8feb0fefb6755b11586ee (diff)
Add gizmo page
Diffstat (limited to 'src/UI.js')
-rw-r--r--src/UI.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/UI.js b/src/UI.js
index eb10598..044eba9 100644
--- a/src/UI.js
+++ b/src/UI.js
@@ -36,3 +36,29 @@ export const _submitShader = (url) => (shader) => () => {
body: data,
});
};
+
+export const _addOption = (nm) => (el) => () => {
+ const opt = document.createElement("option");
+ opt.value = nm
+ opt.innerHTML = nm;
+ el.appendChild(opt);
+};
+
+export const _onInput = (el) => (f) => () => {
+ el.addEventListener("input", (ev) => {
+ f(ev.target.value)();
+ });
+};
+
+export const _startBufferRefresh = (url) => (iframe) => () => {
+ const socket = new WebSocket(url);
+ socket.addEventListener("open", (ev) => {
+ console.log("connected");
+ });
+ const select = document.getElementById("lcolonq-gizmo-select");
+ socket.addEventListener("message", async (ev) => {
+ if (select.value == ev.data) {
+ iframe.src = iframe.src;
+ }
+ });
+};