Type Function Object Runtime Library none Return value Boolean Revision 2017.3060 Keywords runtime, hasEventSource See also EventDispatcher:addEventListener()
Determines if the device is capable of providing events for a given event source such as "accelerometer"
or "gyroscope"
.
This function returns true
if the event source exists, meaning it is okay to call EventDispatcher:addEventListener() to handle its events.
It returns false
if the event source does not exist. For example, if this returns false for "gyroscope"
then this would indicate that the appropriate hardware was not found on the device.
Runtime:hasEventSource( eventSourceName )
String. The name of the event source for which to check existence. The following values are valid:
"accelerometer"
"gyroscope"
"heading"
"inputDeviceStatus"
"key"
"location"
"mouse"
"multitouch"
"orientation"
if Runtime:hasEventSource( "gyroscope" ) then Runtime:addEventListener( "gyroscope", myListener ) end