UNPKG

1.14 kBJavaScriptView Raw
1/**
2 * @param {?} plt
3 * @return {?}
4 */
5export function isCordova(plt) {
6 var /** @type {?} */ win = plt.win();
7 return !!(win['cordova'] || win['PhoneGap'] || win['phonegap']);
8}
9/**
10 * @param {?} plt
11 * @return {?}
12 */
13export function isElectron(plt) {
14 return plt.testUserAgent('Electron');
15}
16/**
17 * @param {?} plt
18 * @return {?}
19 */
20export function isIos(plt) {
21 // shortcut function to be reused internally
22 // checks navigator.platform to see if it's an actual iOS device
23 // this does not use the user-agent string because it is often spoofed
24 // an actual iPad will return true, a chrome dev tools iPad will return false
25 return plt.testNavigatorPlatform('iphone|ipad|ipod');
26}
27/**
28 * @param {?} plt
29 * @return {?}
30 */
31export function isSafari(plt) {
32 return plt.testUserAgent('Safari');
33}
34/**
35 * @param {?} plt
36 * @return {?}
37 */
38export function isWKWebView(plt) {
39 return isIos(plt) && !!((plt.win()))['webkit'];
40}
41/**
42 * @param {?} plt
43 * @return {?}
44 */
45export function isIosUIWebView(plt) {
46 return isIos(plt) && !isWKWebView(plt) && !isSafari(plt);
47}
48//# sourceMappingURL=platform-utils.js.map
\No newline at end of file