From 09c93ac86d42f1ee0efc0740092b8b12e813cba9 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 14 Jul 2018 23:47:31 +0900 Subject: [PATCH] ui: Avoid using eval --- internal/ui/ui_js.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go index 03050a64c..cb78217f2 100644 --- a/internal/ui/ui_js.go +++ b/internal/ui/ui_js.go @@ -54,7 +54,7 @@ var ( window = js.Global().Get("window") document = js.Global().Get("document") requestAnimationFrame = window.Get("requestAnimationFrame") - setTimeoutForLoop = js.Global().Call("eval", "((f) => { setTimeout(f, 0); })") + setTimeout = window.Get("setTimeout") ) func MonitorSize() (int, int) { @@ -229,7 +229,7 @@ func (u *userInterface) loop(g GraphicsContext) error { if u.vsync { requestAnimationFrame.Invoke(cf) } else { - setTimeoutForLoop.Invoke(cf) + setTimeout.Invoke(cf, 0) } } cf = js.NewCallback(f)