github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/pipes/term/term_js.go (about) 1 //go:build js 2 // +build js 3 4 package term 5 6 import ( 7 "os" 8 "sync" 9 "syscall/js" 10 11 "github.com/lmorg/murex/utils/readline" 12 ) 13 14 var divMutex sync.Mutex 15 16 func vtermWrite(r []rune) { 17 readline.VTerm.Write(r) 18 19 html := readline.VTerm.ExportHtml() 20 21 divMutex.Lock() 22 23 jsDoc := js.Global().Get("document") 24 outElement := jsDoc.Call("getElementById", "term") 25 outElement.Set("innerHTML", html) 26 27 divMutex.Unlock() 28 } 29 30 func (t *term) File() *os.File { 31 return nil 32 }