@gentrace/core
Version:
Core Gentrace Node.JS library
44 lines (43 loc) • 1.43 kB
TypeScript
declare namespace _default {
export let isBrowser: boolean;
export namespace classes {
export { URLSearchParams };
export { FormData };
export { Blob };
}
export { isStandardBrowserEnv };
export { isStandardBrowserWebWorkerEnv };
export let protocols: string[];
}
export default _default;
import URLSearchParams from './classes/URLSearchParams.js';
import FormData from './classes/FormData.js';
import Blob from './classes/Blob.js';
/**
* Determine if we're running in a standard browser environment
*
* This allows axios to run in a web worker, and react-native.
* Both environments support XMLHttpRequest, but not fully standard globals.
*
* web workers:
* typeof window -> undefined
* typeof document -> undefined
*
* react-native:
* navigator.product -> 'ReactNative'
* nativescript
* navigator.product -> 'NativeScript' or 'NS'
*
* @returns {boolean}
*/
declare const isStandardBrowserEnv: boolean;
/**
* Determine if we're running in a standard browser webWorker environment
*
* Although the `isStandardBrowserEnv` method indicates that
* `allows axios to run in a web worker`, the WebWorker will still be
* filtered out due to its judgment standard
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
* This leads to a problem when axios post `FormData` in webWorker
*/
declare const isStandardBrowserWebWorkerEnv: boolean;