Detecting window events - firefox and other browsers

I am trying to pass TouchEvent to a method using angular. When I define the event as a TouchEvent, everything works in Chrome, but Firefox will throw a ReferenceError, "TouchEvent not defined". When I define the event as window.TouchEvent, the event works with the webpack-dev-server, although my editor highlights the "window" as an error with "Cannot find namespace". The main problem is the window error is preventing me from compiling my app with webpack.

My fix was to go through the TouchEvent as an event: any, but if there is a better fix I'd like to know. I would also like to understand why this is happening, in case anyone knows. I am using webpack2 and angular4. Thanks in advance.

+3


source to share





All Articles