mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
ui: Add goroutine so that blocking is available everywhere
This commit is contained in:
parent
b454ff6547
commit
b86f1771e4
@ -96,12 +96,14 @@ func (u *userInterface) loop(g GraphicsContext) error {
|
||||
ch := make(chan error)
|
||||
var f func()
|
||||
f = func() {
|
||||
go func() {
|
||||
if err := u.update(g); err != nil {
|
||||
ch <- err
|
||||
close(ch)
|
||||
return
|
||||
}
|
||||
js.Global.Get("window").Call("requestAnimationFrame", f)
|
||||
}()
|
||||
}
|
||||
f()
|
||||
return <-ch
|
||||
|
Loading…
Reference in New Issue
Block a user