Browse Source

Don't add empty gamepads

master
Alexander Yakovlev 5 years ago
parent
commit
e63c6b5cec
  1. 5
      src/init.coffee

5
src/init.coffee

@ -3,7 +3,7 @@ $(document).on("viewinit", () ->
salet.view.gamepads = []
jQuery.ajax({
dataType: 'json',
url: 'mappings.json',
url: salet.view.gamepadmappings,
success: (data) ->
salet.view.gamepadmappings = data
window.addEventListener("gamepadconnected", (e) ->
@ -14,6 +14,7 @@ $(document).on("viewinit", () ->
)
if (typeof navigator.getGamepads == "function")
for pad in navigator.getGamepads()
salet.view.gamepads[pad.index] = new Gamepad(pad)
if pad?
salet.view.gamepads[pad.index] = new Gamepad(pad)
})
)

Loading…
Cancel
Save