Skip to content

Commit

Permalink
fix: update is-browser.ts to account undefined navigator (#1868)
Browse files Browse the repository at this point in the history
* Update is-browser.ts

Fixes electron 12.2.3, which doesn't have navigator defined

6a03d29#commitcomment-142114121

* Making recommended changes #1868 (review)

---------

Co-authored-by: Cody Moniz <[email protected]>
  • Loading branch information
cmoniz-ocean and unyo authored May 17, 2024
1 parent c36a4b0 commit 0111a7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/is-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const isStandardBrowserEnv = () => {
// Is the process an electron application
// check if we are in electron `renderer`
const electronRenderCheck =
navigator?.userAgent?.toLowerCase().indexOf(' electron/') > -1
typeof navigator !== 'undefined' &&
navigator.userAgent?.toLowerCase().indexOf(' electron/') > -1
if (electronRenderCheck && process?.versions) {
const electronMainCheck = Object.prototype.hasOwnProperty.call(
process.versions,
Expand Down

0 comments on commit 0111a7a

Please sign in to comment.