UNPKG

3.14 kBTypeScriptView Raw
1// Type definitions for Platform 1.3
2// Project: https://github.com/bestiejs/platform.js
3// Definitions by: Jake Hickman <https://github.com/JakeH>
4// Piotr Błażejewicz <https://github.com/peterblazejewicz>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
7export as namespace platform;
8
9/**
10 * The platform object.
11 */
12interface Platform {
13 /**
14 * The platform description.
15 */
16 description?: string | undefined;
17 /**
18 * The name of the browser's layout engine.
19 *
20 * The list of common layout engines include:
21 * "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit"
22 */
23 layout?: string | undefined;
24 /**
25 * The name of the product's manufacturer.
26 *
27 * The list of manufacturers include:
28 * "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry",
29 * "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo",
30 * "Nokia", "Samsung" and "Sony"
31 */
32 manufacturer?: string | undefined;
33 /**
34 * The name of the browser/environment.
35 *
36 * The list of common browser names include:
37 * "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE",
38 * "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk",
39 * "Opera Mini" and "Opera"
40 *
41 * Mobile versions of some browsers have "Mobile" appended to their name:
42 * eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile"
43 */
44 name?: string | undefined;
45 /**
46 * The alpha/beta release indicator.
47 */
48 prerelease?: string | undefined;
49 /**
50 * The name of the product hosting the browser.
51 *
52 * The list of common products include:
53 *
54 * "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle",
55 * "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer"
56 */
57 product?: string | undefined;
58 /**
59 * The browser's user agent string.
60 */
61 ua?: string | undefined;
62 /**
63 * The version of the OS.
64 */
65 version?: string | undefined;
66 /**
67 * The name of the operating system.
68 */
69 os?: OperatingSystem | undefined;
70 /**
71 * Creates a new platform object.
72 * @param [ua=navigator.userAgent] The user agent string or
73 * context object.
74 */
75 parse(ua?: object | string): Platform;
76 /**
77 * Returns `platform.description` when the platform object is coerced to a string.
78 */
79 toString(): string;
80}
81
82interface OperatingSystem {
83 /**
84 * The CPU architecture the OS is built for.
85 */
86 architecture?: number | undefined;
87 /**
88 * The family of the OS.
89 *
90 * Common values include:
91 * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
92 * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat",
93 * "SuSE", "Android", "iOS" and "Windows Phone"
94 */
95 family?: string | undefined;
96 /**
97 * The version of the OS.
98 */
99 version?: string | undefined;
100 /**
101 * Returns the OS string.
102 */
103 toString(): string;
104}
105
106declare const platform: Platform;
107
108export = platform;