mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +01:00
web: Optimization: Cache user agent value
This commit is contained in:
parent
4396978d4b
commit
57d493a549
@ -30,20 +30,20 @@ func IsBrowser() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var userAgent = js.Global().Get("navigator").Get("userAgent").String()
|
||||||
|
|
||||||
func IsIOSSafari() bool {
|
func IsIOSSafari() bool {
|
||||||
ua := js.Global().Get("navigator").Get("userAgent").String()
|
if !strings.Contains(userAgent, "iPhone") {
|
||||||
if !strings.Contains(ua, "iPhone") {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsAndroidChrome() bool {
|
func IsAndroidChrome() bool {
|
||||||
ua := js.Global().Get("navigator").Get("userAgent").String()
|
if !strings.Contains(userAgent, "Android") {
|
||||||
if !strings.Contains(ua, "Android") {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !strings.Contains(ua, "Chrome") {
|
if !strings.Contains(userAgent, "Chrome") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user