API Reference

Class List

TouchEvent

A Event corresponding to touchstart, touchend, touchmove or touchcancel. TouchEvent wraps the standard browser DOM event and provides lists of Touch objects.

Summary

Properties

changedTouches

A list of touches that have changed since the last event.

element

The target DOM element that the event was fired from.

event

The original browser TouchEvent.

touches

A list of all touches currently in contact with the device.

Methods

getTouchById

Get an event from one of the touch lists by the id.

Details

Constructor

TouchEvent(device, event)

Create a new TouchEvent instance. It is created from an existing browser event.

Parameters

deviceTouchDevice

The source device of the touch events.

eventglobalThis.TouchEvent

The original browser TouchEvent.

Properties

Touch[]changedTouches

A list of touches that have changed since the last event.

Elementelement

The target DOM element that the event was fired from.

globalThis.TouchEventevent

The original browser TouchEvent.

Touch[]touches

A list of all touches currently in contact with the device.

Methods

getTouchById(id, list)

Get an event from one of the touch lists by the id. It is useful to access touches by their id so that you can be sure you are referencing the same touch.

Parameters

idnumber

The identifier of the touch.

listTouch[], null

An array of touches to search.

Returns

Touch

The Touch object or null.