diff options
| author | LLLL Colonq <llll@colonq> | 2025-04-15 21:10:01 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-04-15 21:10:01 -0400 |
| commit | b31fd7881f8da11dbdd1cc259907b535d96a47a4 (patch) | |
| tree | 1829fe570e53a0876990c6056da6f71880b65493 /src/UI.js | |
| parent | bd1256504b6154c7d9b8feb0fefb6755b11586ee (diff) | |
Add gizmo page
Diffstat (limited to 'src/UI.js')
| -rw-r--r-- | src/UI.js | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -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; + } + }); +}; |
