Button events are only sent as frequently as determined by Joystick.setPeriod, as a result of user interaction beyond the set threshold (see Joystick.setThreshold). If the user does not move the joystick or press buttons, no events are triggered.

Notification data is returned as a string of comma separated values. In the listings below, the field names have the following meanings:

To activate the event notification system, use Joystick.start. To temporarily stop the joystick from generating events, use Joystick.stop.

Joystick.setNotify may be called before Joystick.start if you wish to define the required event notifications before starting the notification system. Also, there is no need to temporarily stop the notification system before making changes to registered events.

Events:

name - onJoyMovetype - triggeredresult - "id,x,y,z,r,u,v,pov"

The onJoyMove event is triggered when the joystick position on the x, y, z, r, u, v axes or the pov changes.

The onJoyAnyButton event is triggered when any button is pressed. The notification data contains information about which joystick and which button triggered the event as well as the button state ("0" for up or "1" for down).

The onJoyButtonMask event is triggered when any button is pressed or released, but unlike onJoyAnyButton a button mask representing the state of all the joystick buttons is returned e.g. "10010000000000000000000000000000", where "1" means the button is down and "0" means the button is up. The position of the 0/1 in the string matches the button number from 0 (leftmost) to 31 (rightmost). The mask returned by onJoyButton mask is always 32 characters long.

The onJoyCombo event is triggered when a specified combination of buttons are pressed at the same time. Button masks passed to the onJoyCombo handler can be anywhere from 1 to 32 characters long. Trailing zeros are ignored so "1001" is the same mask as "10010000" or "10010000000000000000000000000000".