touchstart

Commons
stable

Handle the `touchstart` phase of a gesture: record the starting X/Y coordinates from the first changed touch point and call the optional `start` callback on the wrapper.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

event
requis
TouchEvent
The native TouchEvent fired by the browser. `changedTouches[0]` is used to read the initial position.
wrapper
requis
TTouchWrapper
The shared gesture state object. `touchstartX` and `touchstartY` are written, and `wrapper.start` is called when defined.

API

Valeur de retour

La valeur retournée par cet util.

Side-effectful — mutates the wrapper and calls the optional callback. Returns nothing.

Usage

Exemples

Extraits de code prêts à coller.

Pair with touchend to detect a swipe

typescript