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:
-
type
StringThe event name to emit
-
data
MixedAny data you want passed along with the event
Returns:
Returns itself.
off
-
type
-
listener
Removes a listener function for an event type
Parameters:
-
type
StringThe event name to emit
-
listener
FunctionThe function to remove
Returns:
Returns itself.
on
-
type
-
listener
Registers a listener function to be run on an event occurance
Parameters:
-
type
StringThe event name to listen for
-
listener
FunctionThe function to execute when the event happens
Returns:
Returns itself.
once
-
type
-
listener
Registers a one-time callback for an event
Parameters:
-
type
StringThe event name to listen for
-
listener
Functionthe callback to call when the event occurs
Returns:
Returns itself.
onGamepadDisconnect
-
event
Called when a gamepad connects (FF Only)
Parameters:
-
event
GamepadConnectEvent
onGamepadDisconnect
-
event
Called when a gamepad disconnects (FF Only)
Parameters:
-
event
GamepadDisconnectEvent
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