@thi.ng/checks
Version:
Collection of 70+ type, feature & value checks
9 lines (8 loc) • 302 B
JavaScript
/**
* On Firefox `TouchEvent` is undefined if the hardware doesn't support touch.
* Therefore this predicate checks for that first before verifying if `e` is
* indeed a `TouchEvent`.
*
* @param e
*/
export const isTouchEvent = (e) => typeof TouchEvent !== "undefined" && e instanceof TouchEvent;