1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-12 02:07:26 +01:00
Pinafore-Web-Client-Frontend/routes/_utils/isMobile.js

12 lines
306 B
JavaScript
Raw Normal View History

2018-03-23 06:53:50 +01:00
// Rough guess at whether this is a "mobile" device or not, for the purposes
// of "device class" estimations
let cached
export function isMobile () {
2018-03-23 16:16:46 +01:00
if (typeof cached === 'undefined') {
2018-03-23 06:53:50 +01:00
cached = !!(process.browser && navigator.userAgent.match(/(iPhone|iPod|iPad|Android)/))
}
return cached
}