mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +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
|
||||
}
|
||||
|
||||
var userAgent = js.Global().Get("navigator").Get("userAgent").String()
|
||||
|
||||
func IsIOSSafari() bool {
|
||||
ua := js.Global().Get("navigator").Get("userAgent").String()
|
||||
if !strings.Contains(ua, "iPhone") {
|
||||
if !strings.Contains(userAgent, "iPhone") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func IsAndroidChrome() bool {
|
||||
ua := js.Global().Get("navigator").Get("userAgent").String()
|
||||
if !strings.Contains(ua, "Android") {
|
||||
if !strings.Contains(userAgent, "Android") {
|
||||
return false
|
||||
}
|
||||
if !strings.Contains(ua, "Chrome") {
|
||||
if !strings.Contains(userAgent, "Chrome") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user