diff --git a/internal/opengl/context_js.go b/internal/opengl/context_js.go index 01f2ee7b0..27e686e94 100644 --- a/internal/opengl/context_js.go +++ b/internal/opengl/context_js.go @@ -21,8 +21,6 @@ import ( "fmt" "github.com/gopherjs/gopherwasm/js" - - "github.com/hajimehoshi/ebiten/internal/web" ) type ( @@ -118,10 +116,6 @@ type context struct { } func Init() error { - if web.IsNodeJS() { - return fmt.Errorf("opengl: Node.js is not supported") - } - if js.Global.Get("WebGLRenderingContext") == js.Undefined { return fmt.Errorf("opengl: WebGL is not supported") } diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go index 3b6551a5d..5c16f1050 100644 --- a/internal/ui/ui_js.go +++ b/internal/ui/ui_js.go @@ -26,7 +26,6 @@ import ( "github.com/hajimehoshi/ebiten/internal/hooks" "github.com/hajimehoshi/ebiten/internal/input" "github.com/hajimehoshi/ebiten/internal/opengl" - "github.com/hajimehoshi/ebiten/internal/web" ) var canvas js.Value @@ -227,10 +226,6 @@ func (u *userInterface) loop(g GraphicsContext) error { } func init() { - // Do nothing in node.js. - if web.IsNodeJS() { - return - } if document.Get("body") == js.Null { ch := make(chan struct{}) window.Call("addEventListener", "load", js.NewCallback(func([]js.Value) { diff --git a/internal/web/js.go b/internal/web/js.go index b12edbcd1..6fc5d15ab 100644 --- a/internal/web/js.go +++ b/internal/web/js.go @@ -28,21 +28,11 @@ var ( isNodeJS = false ) -func IsNodeJS() bool { - isNodeJSOnce.Do(func() { - isNodeJS = js.Global.Get("process") != js.Undefined - }) - return isNodeJS -} - func IsBrowser() bool { - return !IsNodeJS() + return true } func IsIOSSafari() bool { - if IsNodeJS() { - return false - } ua := js.Global.Get("navigator").Get("userAgent").String() if !strings.Contains(ua, "iPhone") { return false @@ -51,9 +41,6 @@ func IsIOSSafari() bool { } func IsAndroidChrome() bool { - if IsNodeJS() { - return false - } ua := js.Global.Get("navigator").Get("userAgent").String() if !strings.Contains(ua, "Android") { return false diff --git a/internal/web/notjs.go b/internal/web/notjs.go index d3b61ca56..65fd6cd89 100644 --- a/internal/web/notjs.go +++ b/internal/web/notjs.go @@ -16,10 +16,6 @@ package web -func IsNodeJS() bool { - return false -} - func IsBrowser() bool { return false }