Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/naptha/tesseract.js.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeromewu <jeromewus@gmail.com>2020-10-14 12:51:26 +0300
committerGitHub <noreply@github.com>2020-10-14 12:51:26 +0300
commit4f3aa3145c43ef9e70528626231219ebd9cb18d1 (patch)
treef3d034f0d35631232c9d6ef6259003c0ffa08a70
parented016bdc26fe14888587509c680330b151304b8d (diff)
parent820c91fa524951902299fb61b4d9732f651e70bc (diff)
Merge pull request #489 from CedricCouton/fix-electron-webview
Fix fetch when running in electron webview
-rw-r--r--src/utils/getEnvironment.js8
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';
}