Gamepad Class
Controls input from gamepads
Constructor
Gamepad
()
Item Index
Methods
Methods
emit
-
type -
data
Emits an event which will run all registered listeners for the event type
Parameters:
-
typeStringThe event name to emit
-
dataMixedAny data you want passed along with the event
Returns:
Returns itself.
off
-
type -
listener
Removes a listener function for an event type
Parameters:
-
typeStringThe event name to emit
-
listenerFunctionThe function to remove
Returns:
Returns itself.
on
-
type -
listener
Registers a listener function to be run on an event occurance
Parameters:
-
typeStringThe event name to listen for
-
listenerFunctionThe function to execute when the event happens
Returns:
Returns itself.
once
-
type -
listener
Registers a one-time callback for an event
Parameters:
-
typeStringThe event name to listen for
-
listenerFunctionthe callback to call when the event occurs
Returns:
Returns itself.
onGamepadDisconnect
-
event
Called when a gamepad connects (FF Only)
Parameters:
-
eventGamepadConnectEvent
onGamepadDisconnect
-
event
Called when a gamepad disconnects (FF Only)
Parameters:
-
eventGamepadDisconnectEvent
pollGamepads
()
Polls for newly connected gamepads (Chrome Only)
pollStatus
()
Polls the gamepad object for status updates and emits events when they occur
startPolling
()
Stats polling for new gamepads and status updates
stopPolling
()
Stops polling for new gamepads and status updates
update
()
Called each frame to update polling mechanisms
Properties
pads
ArrayThe currently activated gamepads list
prevTimestamps
ArrayTimestamp tracking for state changes
ticking
Boolean
Tracks if we are polling for status/connections