Skip to content

Instantly share code, notes, and snippets.

@tmikeschu
Created May 7, 2020 22:31
Show Gist options
  • Save tmikeschu/f5977f74d91fbf9371559b3aa43b18d8 to your computer and use it in GitHub Desktop.
Save tmikeschu/f5977f74d91fbf9371559b3aa43b18d8 to your computer and use it in GitHub Desktop.
const isBrowser = typeof window !== "undefined"
// We check for event support via functions in case they've been mocked by a testing suite.
export const supportsPointerEvents = () =>
isBrowser && window.onpointerdown === null
export const supportsTouchEvents = () =>
isBrowser && window.ontouchstart === null
export const supportsMouseEvents = () =>
isBrowser && window.onmousedown === null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment