forked from hgoebl/mobile-detect.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobile-detect.d.ts
70 lines (58 loc) · 1.9 KB
/
mobile-detect.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
declare class MobileDetect {
static version: string;
static isPhoneSized(maxPhoneWidth?: number): boolean;
// only used internally; if necessary, one can replace, intercept or augment particular methods or values
static _impl: MobileDetect.MobileDetectImpl;
constructor(userAgent: string, maxPhoneWidth?: number);
mobile(): string;
phone(): string;
tablet(): string;
userAgent(): string;
userAgents(): string[];
os(): string;
version(value: string): number;
versionStr(value: string): string;
is(key: string): boolean;
match(pattern: string|RegExp): boolean;
isPhoneSized(maxPhoneWidth?: number): boolean;
mobileGrade(): string;
}
declare namespace MobileDetect {
interface MobileDetectRules {
[key: string]: string|RegExp;
}
interface MobileDetectComplexRules {
[key: string]: string|RegExp|string[]|RegExp[];
}
interface MobileDetectImpl {
mobileDetectRules: {
phones: MobileDetectRules;
tablets: MobileDetectRules;
oss: MobileDetectRules;
uas: MobileDetectRules;
props: MobileDetectComplexRules;
utils: MobileDetectRules;
};
detectMobileBrowsers: {
fullPattern: RegExp;
shortPattern: RegExp;
tabletPattern: RegExp;
};
FALLBACK_PHONE: string;
FALLBACK_TABLET: string;
FALLBACK_MOBILE: string;
findMatch(rules: MobileDetectRules, userAgent: string): string;
findMatches(rules: MobileDetectRules, userAgent: string): string[];
getVersionStr(propertyName: string, userAgent: string): string;
getVersion(propertyName: string, userAgent: string): number;
prepareVersionNo(version: string): number;
isMobileFallback(userAgent: string): boolean;
isTabletFallback(userAgent: string): boolean;
prepareDetectionCache(cache: Object, userAgent: string, maxPhoneWidth?: number): void;
mobileGrade(md: MobileDetect): string;
detectOS(userAgent: string): string;
getDeviceSmallerSide(): number;
}
}
export = MobileDetect;
export as namespace MobileDetect;