UNPKG

2.85 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2017 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 * Returns navigator.userAgent string or '' if it's not defined.
19 * @return user agent string
20 */
21export declare function getUA(): string;
22/**
23 * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device.
24 *
25 * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap
26 * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally
27 * wait for a callback.
28 */
29export declare function isMobileCordova(): boolean;
30/**
31 * Detect Node.js.
32 *
33 * @return true if Node.js environment is detected or specified.
34 */
35export declare function isNode(): boolean;
36/**
37 * Detect Browser Environment
38 */
39export declare function isBrowser(): boolean;
40export declare function isBrowserExtension(): boolean;
41/**
42 * Detect React Native.
43 *
44 * @return true if ReactNative environment is detected.
45 */
46export declare function isReactNative(): boolean;
47/** Detects Electron apps. */
48export declare function isElectron(): boolean;
49/** Detects Internet Explorer. */
50export declare function isIE(): boolean;
51/** Detects Universal Windows Platform apps. */
52export declare function isUWP(): boolean;
53/**
54 * Detect whether the current SDK build is the Node version.
55 *
56 * @return true if it's the Node SDK build.
57 */
58export declare function isNodeSdk(): boolean;
59/** Returns true if we are running in Safari. */
60export declare function isSafari(): boolean;
61/**
62 * This method checks if indexedDB is supported by current browser/service worker context
63 * @return true if indexedDB is supported by current browser/service worker context
64 */
65export declare function isIndexedDBAvailable(): boolean;
66/**
67 * This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject
68 * if errors occur during the database open operation.
69 *
70 * @throws exception if current browser/sw context can't run idb.open (ex: Safari iframe, Firefox
71 * private browsing)
72 */
73export declare function validateIndexedDBOpenable(): Promise<boolean>;
74/**
75 *
76 * This method checks whether cookie is enabled within current browser
77 * @return true if cookie is enabled within current browser
78 */
79export declare function areCookiesEnabled(): boolean;