mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
ui: Avoid using eval
This commit is contained in:
parent
e25c237a01
commit
09c93ac86d
@ -54,7 +54,7 @@ var (
|
|||||||
window = js.Global().Get("window")
|
window = js.Global().Get("window")
|
||||||
document = js.Global().Get("document")
|
document = js.Global().Get("document")
|
||||||
requestAnimationFrame = window.Get("requestAnimationFrame")
|
requestAnimationFrame = window.Get("requestAnimationFrame")
|
||||||
setTimeoutForLoop = js.Global().Call("eval", "((f) => { setTimeout(f, 0); })")
|
setTimeout = window.Get("setTimeout")
|
||||||
)
|
)
|
||||||
|
|
||||||
func MonitorSize() (int, int) {
|
func MonitorSize() (int, int) {
|
||||||
@ -229,7 +229,7 @@ func (u *userInterface) loop(g GraphicsContext) error {
|
|||||||
if u.vsync {
|
if u.vsync {
|
||||||
requestAnimationFrame.Invoke(cf)
|
requestAnimationFrame.Invoke(cf)
|
||||||
} else {
|
} else {
|
||||||
setTimeoutForLoop.Invoke(cf)
|
setTimeout.Invoke(cf, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cf = js.NewCallback(f)
|
cf = js.NewCallback(f)
|
||||||
|
Loading…
Reference in New Issue
Block a user