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)
|
ch := make(chan error)
|
||||||
var f func()
|
var f func()
|
||||||
f = func() {
|
f = func() {
|
||||||
if err := u.update(g); err != nil {
|
go func() {
|
||||||
ch <- err
|
if err := u.update(g); err != nil {
|
||||||
close(ch)
|
ch <- err
|
||||||
return
|
close(ch)
|
||||||
}
|
return
|
||||||
js.Global.Get("window").Call("requestAnimationFrame", f)
|
}
|
||||||
|
js.Global.Get("window").Call("requestAnimationFrame", f)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
f()
|
f()
|
||||||
return <-ch
|
return <-ch
|
||||||
|
Loading…
Reference in New Issue
Block a user