Event

Event represents the event object when the event is triggered, which contains the state information when the event is triggered. Developers can listen through the Event Handler Property.

Lynx has many different types of event objects, all of which are directly or indirectly inherited from Event. Event itself contains properties and methods applicable to all event objects.

Event type

TouchEvent

TouchEvent represents a touch event object, which describes the state change of a finger on a touch surface (such as a touch screen).

CustomEvent

CustomEvent represents a custom event object, which describes the state change of a custom component.

AnimationEvent

AnimationEvent represents an animation event object, describing the state changes of the CSS animation life cycle.

Instance property

type

type: string;

Indicates the type of event.

timestamp

timestamp: number;

Indicates the timestamp when the event was generated.

target

target: {
  id: string,
  uid: number,
  dataset: [key: string]: any,
}

Indicates a collection of some attribute values ​​of element that triggered the event.

  • id: element's id selector.
  • uid: element's unique identifier in Lynx Engine.
  • dataset: A collection of custom attributes starting with data- on element.

currentTarget

currentTarget: {
  id: string,
  uid: number,
  dataset: [key: string]: any,
}

A collection of attribute values ​​of element that listens to events.

  • id: element's id selector.
  • uid: element's unique identifier in Lynx Engine.
  • dataset: A collection of custom attributes starting with data- on element.

Instance method

stopPropagation

stopPropagation(): void;

Stop bubbling and prevent the event from continuing to bubble up the touch response chain.

This method is only implemented in the main thread script. Calling it in the main thread script can affect both event bubbling and event handler triggering in JS.

stopImmediatePropagation

stopImmediatePropagation(): void;

Stop bubbling, prevent the event from continuing to bubble in the event response chain, and prevent other event handlers of the same event on the current node from being triggered.

This method is only implemented in the main thread script. Calling it in the main thread script can affect both event bubbling and event handler triggering in JS.

Compatibility

LCD tables only load in the browser

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.