Recently, while working on a project utilizing Angular 8, I encountered an issue regarding touch event handling. In my code, I had a handler setup like this:
@HostListener('touchend', ['$event']) onTouchend(event: TouchEvent) {
event.preventDefault();
}
Interestingly, when testing on MacOS 10.15, everything worked smoothly in Chrome but ran into issues with Safari. An error message stating "ReferenceError: Can't find variable: TouchEvent" popped up in Safari, and in Firefox there was another error - "ReferenceError: TouchEvent is not defined". Surprisingly, changing the event type to 'any' allowed it to function in both Safari and Firefox. This leaves me wondering why TouchEvent doesn't work on Safari.