Browse Source

Merge pull request #489 from CedricCouton/fix-electron-webview

Fix fetch when running in electron webview
pull/491/head
jeromewu 4 years ago committed by GitHub
parent
commit
4f3aa3145c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/utils/getEnvironment.js

8
src/utils/getEnvironment.js

@ -3,12 +3,12 @@ const isElectron = require('is-electron'); @@ -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';
}

Loading…
Cancel
Save