Touch
23 Sep 20252 minutes to read
Touch class provides support to handle the touch event like tap, double tap, tap hold, etc..,
let node: HTMLElement;
let touchObj: Touch = new Touch({
element: node,
tap: function (e) {
// tap handler function code
}
tapHold: function (e) {
// tap hold handler function code
}
scroll: function (e) {
// scroll handler function code
}
swipe: function (e) {
// swipe handler function code
}
});Properties
swipeSettings SwipeSettingsModel
Customize the swipe event configuration.
Defaults to { swipeThresholdDistance: 50 }
tapHoldThreshold number
Specifies the time delay for tap hold.
Defaults to 750
tapThreshold number
Specifies the time delay for tap.
Defaults to 350
Methods
addEventListener
Adds the handler to the given event listener.
| Parameter | Type | Description |
|---|---|---|
| eventName | string |
A String that specifies the name of the event |
| handler | Function |
Specifies the call to run when the event occurs. |
Returns void
dataBind
Bind property changes immediately to components
Returns void
destroy
To destroy the touch instance.
Returns void
removeEventListener
Removes the handler from the given event listener.
| Parameter | Type | Description |
|---|---|---|
| eventName | string |
A String that specifies the name of the event to remove |
| handler | Function |
Specifies the function to remove |
Returns void
Events
scroll EmitType<ScrollEventArgs>
Specifies the callback function for scroll event.
swipe EmitType<SwipeEventArgs>
Specifies the callback function for swipe event.
tap EmitType<TapEventArgs>
Specifies the callback function for tap event.
tapHold EmitType<TapEventArgs>
Specifies the callback function for tapHold event.