Why Chrome emits PointerEvents and Firefox MouseEvents and which type definition should I use in my code

Viewed 134

I'm somewhat new to typescript and try to add type definitions to all my methods while being as precise as possible.

When I click in Chrome a PointerEvent is emitted. In Firefox a MouseEvent is emitted. I know that PointerEvent extends MouseEvent and according to https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#browser_compatibility Firefox also supports these.

  1. Why does chrome emit a different event than Firefox
  2. Which type should I use in my event listeners (probably MouseEvent)
  3. and most importantly, how do I determine that if both show something different? (a.k.a is it safe to trust chrome or do I have to consult the documentation?)
0 Answers
Related