Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM

Exercise: Touch Gesture Handling

Create a touch gesture handler that detects the swipe direction and emits the appropriate custom event.

Task

The index.js file has the TouchGestureHandler class from the gestures lesson. Fill in the blanks: ___BLANK1___ is the touch event sent while the finger moves across the screen, ___BLANK2___ is the name of the direction when the finger moved up by more than 50 px, and ___BLANK3___ is the CustomEvent option field in which the swipe event carries the data { direction, deltaX, deltaY }. A move of more than 50 px should send one swipe event with the direction left, right, up or down, and a tap or a small move none.