This commit is contained in:
Chris Wanstrath 2025-09-19 14:47:00 -07:00
parent 25b0ead8b1
commit d7a96baa4b
5 changed files with 22 additions and 12 deletions

View File

@ -1,5 +1,10 @@
import { cmdTextbox } from "./dom.js"
export function initFocus() {
window.addEventListener("click", focusHandler)
focusTextbox()
}
export function focusTextbox() {
cmdTextbox.focus()
}
@ -29,4 +34,4 @@ export function focusHandler(e: MouseEvent) {
e.preventDefault()
return true
}
}
}

View File

@ -1,11 +1,10 @@
import { resize } from "./resize.js"
import { focusTextbox, focusHandler } from "./focus.js"
import { initResize } from "./resize.js"
import { initFocus } from "./focus.js"
import { startVramCounter } from "./vram.js"
import { startConnection } from "./websocket.js"
window.addEventListener("click", focusHandler)
focusTextbox()
window.addEventListener("resize", resize)
resize()
initFocus()
initResize()
startConnection()
startVramCounter()

View File

@ -1,5 +1,10 @@
const content = document.getElementById("content")!
export function initResize() {
window.addEventListener("resize", resize)
resize()
}
export function resize() {
if (document.body.dataset.mode === "tall") {
resizeTall()

View File

@ -11,15 +11,13 @@ export const startVramCounter = () => {
const count = parseInt(vramCounter.textContent!) + 1
let val = count + "KB"
if (count < 10)
val = "00" + val
else if (count < 100)
val = "0" + val
vramCounter.textContent = val
if (count >= 640) {
if (count >= 64) {
vramCounter.textContent += " OK"
clearInterval(timer)
}
}, 5)
}, 15)
}

3
src/js/websocket.ts Normal file
View File

@ -0,0 +1,3 @@
export function startConnection() {
console.log("whee")
}