repo
replacements.fyi

// package

is-touch-device

type: "module"

// preferences

// replacements (1)

snippet::is-touch-device

Simple or drop-in replacement

This package is no longer necessary. You can check if the current device is a touch device by checking the `'ontouchstart'` propery of the `window` object and `maxTouchPoints` of the `navigator` object.

// example

const isTouchDevice =
	window &&
	('ontouchstart' in window ||
		navigator.maxTouchPoints);