touchend

Commons
stable

Handle the `touchend` phase of a gesture: record the ending X/Y coordinates, call the optional `end` callback, then delegate to `handleGesture` to fire the directional callbacks (left, right, up, down).

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 end position.
wrapper
required
TTouchWrapper
The shared gesture state object. `touchendX` and `touchendY` are written; `wrapper.end` is called when defined, then `handleGesture` evaluates the directional callbacks.

API

Return value

The value returned by this util.

Side-effectful — mutates the wrapper and fires callbacks. Returns nothing.

Usage

Examples

Ready-to-paste usage snippets.

Detect a left swipe with touchend

typescript