mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-13 22:47:26 +01:00
ui: Use goroutine to avoid blocking on GopherJS
This commit is contained in:
parent
3136ef5fbd
commit
6e12f287b0
@ -208,8 +208,10 @@ func (u *userInterface) loop(g GraphicsContext) error {
|
|||||||
var cf js.Callback
|
var cf js.Callback
|
||||||
f = func([]js.Value) {
|
f = func([]js.Value) {
|
||||||
if err := u.update(g); err != nil {
|
if err := u.update(g); err != nil {
|
||||||
ch <- err
|
go func() {
|
||||||
close(ch)
|
ch <- err
|
||||||
|
close(ch)
|
||||||
|
}()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
js.Global.Get("window").Call("requestAnimationFrame", cf)
|
js.Global.Get("window").Call("requestAnimationFrame", cf)
|
||||||
|
Loading…
Reference in New Issue
Block a user