From 2acb604260ed0078e6220cb01234a5b04b35dd2c Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 16 Aug 2020 23:05:33 +0900 Subject: [PATCH] examples/contextlost: Bug fix: Failed to compile with Go 1.12 --- examples/contextlost/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/contextlost/main.go b/examples/contextlost/main.go index 0921bf70d..2d06d84a0 100644 --- a/examples/contextlost/main.go +++ b/examples/contextlost/main.go @@ -56,7 +56,7 @@ func (g *Game) loseAndRestoreContext(context js.Value) { // Edge might not support the extension. See // https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context ext := context.Call("getExtension", "WEBGL_lose_context") - if ext.IsNull() { + if !ext.Truthy() { fmt.Println("Fail to force context lost. Edge might not support the extension yet.") return } @@ -83,9 +83,9 @@ func (g *Game) Update(screen *ebiten.Image) error { doc := js.Global().Get("document") canvas := doc.Call("getElementsByTagName", "canvas").Index(0) context := canvas.Call("getContext", "webgl2") - if context.IsNull() { + if !context.Truthy() { context = canvas.Call("getContext", "webgl") - if context.IsNull() { + if !context.Truthy() { context = canvas.Call("getContext", "experimental-webgl") } }