Skip to content

Commit

Permalink
Make the isBrowser check aware of edge case with electron built apps
Browse files Browse the repository at this point in the history
They will be marked as browsers because of global.window, erroneously.
  • Loading branch information
themadtitanmathos committed Apr 8, 2021
1 parent 470f9ca commit b5751bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/WebApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ import os = require('os');
import url = require('url');
import path = require('path');

const isBrowser: boolean = typeof window !== 'undefined';
const isElectron: boolean = process && process.versions && process.versions.hasOwnProperty('electron');
const isElectronWebpage: boolean = isElectron && process.type === 'renderer';
const isBrowser: boolean = typeof window !== 'undefined' && (!isElectron || isElectronWebpage);

/**
* Methods to return handler objects (see handlers folder)
*/
Expand Down

0 comments on commit b5751bb

Please sign in to comment.