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

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

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

API

Return value

The value returned by this util.

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

Usage

Examples

Ready-to-paste usage snippets.

Pair with touchend to detect a swipe

typescript