UNPKG

3.77 kBTypeScriptView Raw
1/**
2 * Provides client-side access to the authoritative PHP-generated User Agent
3 * information supplied by the server.
4 */
5declare namespace UserAgent {
6 /**
7 * Check if the User Agent browser matches `query`.
8 *
9 * `query` should be a string like "Chrome" or "Chrome > 33".
10 *
11 * Valid browser names include:
12 *
13 * - ACCESS NetFront
14 * - AOL
15 * - Amazon Silk
16 * - Android
17 * - BlackBerry
18 * - BlackBerry PlayBook
19 * - Chrome
20 * - Chrome for iOS
21 * - Chrome frame
22 * - Facebook PHP SDK
23 * - Facebook for iOS
24 * - Firefox
25 * - IE
26 * - IE Mobile
27 * - Mobile Safari
28 * - Motorola Internet Browser
29 * - Nokia
30 * - Openwave Mobile Browser
31 * - Opera
32 * - Opera Mini
33 * - Opera Mobile
34 * - Safari
35 * - UIWebView
36 * - Unknown
37 * - webOS
38 * - etc...
39 *
40 * An authoritative list can be found in the PHP `BrowserDetector` class and
41 * related classes in the same file (see calls to `new UserAgentBrowser` here:
42 * https://fburl.com/50728104).
43 *
44 * @note Function results are memoized
45 */
46 function isBrowser(query: string): boolean;
47
48 /**
49 * Check if the User Agent browser uses a 32 or 64 bit architecture.
50 *
51 * @note Function results are memoized
52 */
53 function isBrowserArchitecture(query: string): boolean;
54
55 /**
56 * Check if the User Agent device matches `query`.
57 *
58 * `query` should be a string like "iPhone" or "iPad".
59 *
60 * Valid device names include:
61 *
62 * - Kindle
63 * - Kindle Fire
64 * - Unknown
65 * - iPad
66 * - iPhone
67 * - iPod
68 * - etc...
69 *
70 * An authoritative list can be found in the PHP `DeviceDetector` class and
71 * related classes in the same file (see calls to `new UserAgentDevice` here:
72 * https://fburl.com/50728332).
73 *
74 * @note Function results are memoized
75 */
76 function isDevice(query: string): boolean;
77
78 /**
79 * Check if the User Agent rendering engine matches `query`.
80 *
81 * `query` should be a string like "WebKit" or "WebKit >= 537".
82 *
83 * Valid engine names include:
84 *
85 * - Gecko
86 * - Presto
87 * - Trident
88 * - WebKit
89 * - etc...
90 *
91 * An authoritative list can be found in the PHP `RenderingEngineDetector`
92 * class related classes in the same file (see calls to `new
93 * UserAgentRenderingEngine` here: https://fburl.com/50728617).
94 *
95 * Function results are memoized
96 */
97 function isEngine(query: string): boolean;
98
99 /**
100 * Check if the User Agent platform matches `query`.
101 *
102 * `query` should be a string like "Windows" or "iOS 5 - 6".
103 *
104 * Valid platform names include:
105 *
106 * - Android
107 * - BlackBerry OS
108 * - Java ME
109 * - Linux
110 * - Mac OS X
111 * - Mac OS X Calendar
112 * - Mac OS X Internet Account
113 * - Symbian
114 * - SymbianOS
115 * - Windows
116 * - Windows Mobile
117 * - Windows Phone
118 * - iOS
119 * - iOS Facebook Integration Account
120 * - iOS Facebook Social Sharing UI
121 * - webOS
122 * - Chrome OS
123 * - etc...
124 *
125 * An authoritative list can be found in the PHP `PlatformDetector` class and
126 * related classes in the same file (see calls to `new UserAgentPlatform`
127 * here: https://fburl.com/50729226).
128 *
129 * Function results are memoized
130 */
131 function isPlatform(query: string): boolean;
132
133 /**
134 * Check if the User Agent platform is a 32 or 64 bit architecture.
135 *
136 * Function results are memoized
137 */
138 function isPlatformArchitecture(query: string): boolean;
139}
140
141// eslint-disable-next-line @definitelytyped/export-just-namespace
142export = UserAgent;