mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
web: Speed optimization
This commit is contained in:
parent
b4969cccd7
commit
9a42b264fd
@ -25,23 +25,31 @@ func IsBrowser() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
var userAgent = js.Global().Get("navigator").Get("userAgent").String()
|
||||
var (
|
||||
userAgent = js.Global().Get("navigator").Get("userAgent").String()
|
||||
|
||||
isIOSSafari bool
|
||||
isAndroidChrome bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
isIOSSafari = strings.Contains(userAgent, "iPhone")
|
||||
|
||||
if !strings.Contains(userAgent, "Android") {
|
||||
isAndroidChrome = false
|
||||
}
|
||||
if !strings.Contains(userAgent, "Chrome") {
|
||||
isAndroidChrome = false
|
||||
}
|
||||
isAndroidChrome = true
|
||||
}
|
||||
|
||||
func IsIOSSafari() bool {
|
||||
if !strings.Contains(userAgent, "iPhone") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return isIOSSafari
|
||||
}
|
||||
|
||||
func IsAndroidChrome() bool {
|
||||
if !strings.Contains(userAgent, "Android") {
|
||||
return false
|
||||
}
|
||||
if !strings.Contains(userAgent, "Chrome") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return isAndroidChrome
|
||||
}
|
||||
|
||||
func IsMobileBrowser() bool {
|
||||
|
Loading…
Reference in New Issue
Block a user