fedilove-ui/routes/_utils/isMobile.js

12 lines
284 B
JavaScript

// Rough guess at whether this is a "mobile" device or not, for the purposes
// of "device class" estimations
let cached
export function isMobile () {
if (!cached) {
cached = !!(process.browser && navigator.userAgent.match(/(iPhone|iPod|iPad|Android)/))
}
return cached
}