aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-13 21:03:13 +0800
committerFabio Berger <me@fabioberger.com>2018-07-13 21:03:13 +0800
commit4c7fd5a4e8b745bfdbfca20b5495f48332aae90d (patch)
treec2a5c56968ebfcdbe508b797a951da3adbbba4a3 /packages/utils/src
parent9d24341d9405a91f9153abd3f21569326392d246 (diff)
downloaddexon-sol-tools-4c7fd5a4e8b745bfdbfca20b5495f48332aae90d.tar
dexon-sol-tools-4c7fd5a4e8b745bfdbfca20b5495f48332aae90d.tar.gz
dexon-sol-tools-4c7fd5a4e8b745bfdbfca20b5495f48332aae90d.tar.bz2
dexon-sol-tools-4c7fd5a4e8b745bfdbfca20b5495f48332aae90d.tar.lz
dexon-sol-tools-4c7fd5a4e8b745bfdbfca20b5495f48332aae90d.tar.xz
dexon-sol-tools-4c7fd5a4e8b745bfdbfca20b5495f48332aae90d.tar.zst
dexon-sol-tools-4c7fd5a4e8b745bfdbfca20b5495f48332aae90d.zip
Replace process.browser with detect-node library
Diffstat (limited to 'packages/utils/src')
-rw-r--r--packages/utils/src/fetchAsync.ts3
-rw-r--r--packages/utils/src/globals.d.ts4
2 files changed, 6 insertions, 1 deletions
diff --git a/packages/utils/src/fetchAsync.ts b/packages/utils/src/fetchAsync.ts
index a009f0c86..47d87815e 100644
--- a/packages/utils/src/fetchAsync.ts
+++ b/packages/utils/src/fetchAsync.ts
@@ -1,3 +1,4 @@
+import isNode = require('detect-node');
import 'isomorphic-fetch';
export const fetchAsync = async (
@@ -6,7 +7,7 @@ export const fetchAsync = async (
timeoutMs: number = 20000,
): Promise<Response> => {
let optionsWithAbortParam;
- if ((process as any).browser === true) {
+ if (isNode) {
const controller = new AbortController();
const signal = controller.signal;
setTimeout(() => {
diff --git a/packages/utils/src/globals.d.ts b/packages/utils/src/globals.d.ts
index 94e63a32d..98a4b56fc 100644
--- a/packages/utils/src/globals.d.ts
+++ b/packages/utils/src/globals.d.ts
@@ -4,3 +4,7 @@ declare module '*.json' {
export default json;
/* tslint:enable */
}
+
+declare module 'detect-node' {
+ export const isNode: boolean;
+}