ui: Use goroutine to avoid blocking on GopherJS

This commit is contained in:
Hajime Hoshi 2018-06-09 03:05:29 +09:00
parent 3136ef5fbd
commit 6e12f287b0

View File

@ -208,8 +208,10 @@ func (u *userInterface) loop(g GraphicsContext) error {
var cf js.Callback
f = func([]js.Value) {
if err := u.update(g); err != nil {
ch <- err
close(ch)
go func() {
ch <- err
close(ch)
}()
return
}
js.Global.Get("window").Call("requestAnimationFrame", cf)