Universal Events

Different from private events, universal events can be bound to most components.

Name

Parameter

Triggered when

touchstart

TouchEvent

The tapping starts

touchmove

TouchEvent

The tapping moves

touchcancel

TouchEvent

The tapping is interrupted

touchend

TouchEvent

The tapping ends

click

-

A component is clicked

longpress

-

A component is long pressed

swipe5+

SwipeEvent

A user quickly swipes on a component.

Table 1 Attributes of the BaseEvent object

Attribute

Type

Description

type

string

Event type, such as click and longpress

timestamp

number

Timestamp when the event is triggered

Table 2 Attributes of the TouchEvent object (inherited from BaseEvent)

Attribute

Type

Description

touches

Array<TouchInfo>

Attribute set of the touch event, including the information array of the touch points on the screen.

changedTouches

Array<TouchInfo>

Attribute set when a touch event occurs, including the information array of changed touch points on the screen. changedTouches has the same data format as touches and indicates touch point changes, such as from no touch point to newly generated touch points, from some touch points to no touch point, and location changes. For example, when the user's finger leaves the touchscreen, no data exists in the touches array, but changedTouches will save the generated data.

Table 3 Attributes of the TouchEvent object

Attribute

Type

Description

globalX

number

Horizontal distance from the upper left corner of the screen (excluding the status bar). The upper left corner of the screen acts as the coordinate origin.

globalY

number

Vertical distance from the upper left corner of the screen (excluding the status bar). The upper left corner of the screen acts as the coordinate origin.

localX

number

Horizontal distance from the upper left corner of the touched component. The upper left corner of the component acts as the coordinate origin.

localY

number

Vertical distance from the upper left corner of the touched component. The upper left corner of the component acts as the coordinate origin.

size

number

Touch area.

Table 4 Attributes of the SwipeEvent object (inherited from BaseEvent)

Attribute

Type

Description

direction

string

Swiping direction. The value can be one of the following:

  1. left: Swipe from right to left
  2. right: Swipe from left to right
  3. up: Swipe upwards
  4. down: Swipe downwards