UNPKG

2.22 kBTypeScriptView Raw
1import { ReTree } from './retree';
2import * as i0 from "@angular/core";
3export interface DeviceInfo {
4 userAgent: string;
5 os: string;
6 browser: string;
7 device: string;
8 os_version: string;
9 browser_version: string;
10 deviceType: string;
11 orientation: string;
12}
13export declare enum DeviceType {
14 Mobile = "mobile",
15 Tablet = "tablet",
16 Desktop = "desktop",
17 Unknown = "unknown"
18}
19export declare enum OrientationType {
20 Portrait = "portrait",
21 Landscape = "landscape"
22}
23export declare class DeviceDetectorService {
24 private platformId;
25 ua: string;
26 userAgent: string;
27 os: string;
28 browser: string;
29 device: string;
30 os_version: string;
31 browser_version: string;
32 reTree: ReTree;
33 deviceType: string;
34 orientation: string;
35 constructor(platformId: any);
36 /**
37 * @author Ahsan Ayaz
38 * @desc Sets the initial value of the device when the service is initiated.
39 * This value is later accessible for usage
40 */
41 setDeviceInfo(ua?: string): void;
42 /**
43 * @author Ahsan Ayaz
44 * @desc Returns the device information
45 * @returns the device information object.
46 */
47 getDeviceInfo(): DeviceInfo;
48 /**
49 * @author Ahsan Ayaz
50 * @desc Compares the current device info with the mobile devices to check
51 * if the current device is a mobile and also check current device is tablet so it will return false.
52 * @returns whether the current device is a mobile
53 */
54 isMobile(userAgent?: string): boolean;
55 /**
56 * @author Ahsan Ayaz
57 * @desc Compares the current device info with the tablet devices to check
58 * if the current device is a tablet.
59 * @returns whether the current device is a tablet
60 */
61 isTablet(userAgent?: string): boolean;
62 /**
63 * @author Ahsan Ayaz
64 * @desc Compares the current device info with the desktop devices to check
65 * if the current device is a desktop device.
66 * @returns whether the current device is a desktop device
67 */
68 isDesktop(userAgent?: string): boolean;
69 static ɵfac: i0.ɵɵFactoryDeclaration<DeviceDetectorService, never>;
70 static ɵprov: i0.ɵɵInjectableDeclaration<DeviceDetectorService>;
71}