UNPKG

@sky-mavis/tanto-widget

Version:
18 lines 600 B
import {UAParser}from'ua-parser-js';import {isClient}from'./common.mjs';function getUserAgent() { if (!isClient()) return undefined; return UAParser(navigator.userAgent); } function detectOS() { const parser = getUserAgent(); return parser?.os.name ?? ''; } function isIOS() { const os = detectOS(); return os.toLowerCase().includes('ios'); } function isAndroid() { const os = detectOS(); return os.toLowerCase().includes('android'); } const isMobile = () => isAndroid() || isIOS(); const isDesktop = () => !isMobile();export{detectOS,getUserAgent,isAndroid,isDesktop,isIOS,isMobile};