export type Os = "ios" | "android" | "macos" | "windows" | "linux" | "unknown"; export type BrowserName = "safari" | "chrome" | "firefox" | "edge" | "unknown"; export type DeviceType = "phone" | "tablet" | "desktop"; export interface DeviceOptions { /** `navigator.maxTouchPoints`. Left out, the device is taken to be untouched. */ touchPoints?: number; } /** * What a user agent string says about the device it came from: the operating * system, the browser, whether it is a phone, a tablet or a desktop, and * whether there is a touch screen. * * It takes the string rather than reading `navigator`, so the same call works * on the server against a request header and a test can hand it whatever it * likes. * * ```ts * const device = Device.parse(navigator.userAgent, { * touchPoints: navigator.maxTouchPoints, * }); * if (device.isPhone()) { ... } * ``` * * It answers those four questions and no others. Browser versions, device * models and bot detection need a maintained database of user agents, which * this is not. */ export declare class Device { readonly os: Os; readonly browser: BrowserName; readonly type: DeviceType; readonly touch: boolean; private constructor(); static parse(userAgent: string, opts?: DeviceOptions): Device; isIos(): boolean; isAndroid(): boolean; isPhone(): boolean; isTablet(): boolean; /** A phone or a tablet, which is to say anything that is not a desktop. */ isMobile(): boolean; isDesktop(): boolean; isTouch(): boolean; }