diff options
author | jeromewu <jeromewus@gmail.com> | 2020-10-14 12:51:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-14 12:51:26 +0300 |
commit | 4f3aa3145c43ef9e70528626231219ebd9cb18d1 (patch) | |
tree | f3d034f0d35631232c9d6ef6259003c0ffa08a70 | |
parent | ed016bdc26fe14888587509c680330b151304b8d (diff) | |
parent | 820c91fa524951902299fb61b4d9732f651e70bc (diff) |
Merge pull request #489 from CedricCouton/fix-electron-webview
Fix fetch when running in electron webview
-rw-r--r-- | src/utils/getEnvironment.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils/getEnvironment.js b/src/utils/getEnvironment.js index 3b4f100..03f5663 100644 --- a/src/utils/getEnvironment.js +++ b/src/utils/getEnvironment.js @@ -3,12 +3,12 @@ const isElectron = require('is-electron'); module.exports = (key) => { const env = {}; - if (isElectron()) { - env.type = 'electron'; + if (typeof WorkerGlobalScope !== 'undefined') { + env.type = 'webworker'; } else if (typeof window === 'object') { env.type = 'browser'; - } else if (typeof importScripts === 'function') { - env.type = 'webworker'; + } else if (isElectron()) { + env.type = 'electron'; } else if (typeof process === 'object' && typeof require === 'function') { env.type = 'node'; } |