Files
chess/internal/client/display/termsize_wasm.go
T
lixen e1fa5242e3
test / test (push) Canceled after 0s
test / e2e (push) Canceled after 0s
v0.15.0 password recovery, phone layout, CLI pager, embed policy fixes
2026-10-19 18:15:31 -04:00

22 lines
458 B
Go

//go:build js && wasm
package display
import "syscall/js"
// The page's terminal wrapper (terminal.js) publishes xterm's size as
// globalThis.chessTerminal.rows and .cols.
func init() {
TermSize = func() (rows, cols int) {
t := js.Global().Get("chessTerminal")
if t.IsUndefined() || t.IsNull() {
return 24, 80
}
rows, cols = t.Get("rows").Int(), t.Get("cols").Int()
if rows <= 0 || cols <= 0 {
return 24, 80
}
return rows, cols
}
}