mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
internal/uidriver/js: Optimization: Reduce the call of js.Value.Get
This commit is contained in:
parent
732b125349
commit
b6cf95f5bb
@ -298,7 +298,8 @@ func (i *Input) updateGamepads() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !nav.Get("getGamepads").Truthy() {
|
gamepads := nav.Call("getGamepads")
|
||||||
|
if !gamepads.Truthy() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +307,6 @@ func (i *Input) updateGamepads() {
|
|||||||
delete(i.gamepads, k)
|
delete(i.gamepads, k)
|
||||||
}
|
}
|
||||||
|
|
||||||
gamepads := nav.Call("getGamepads")
|
|
||||||
l := gamepads.Length()
|
l := gamepads.Length()
|
||||||
for idx := 0; idx < l; idx++ {
|
for idx := 0; idx < l; idx++ {
|
||||||
gp := gamepads.Index(idx)
|
gp := gamepads.Index(idx)
|
||||||
|
Loading…
Reference in New Issue
Block a user