Skip to content

Commit

Permalink
Add environment check
Browse files Browse the repository at this point in the history
It's mandatory to check if `window` element is present in global scope
before it's used.
  • Loading branch information
kpyszkowski committed Nov 1, 2023
1 parent a46b0f9 commit 3ad8f4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions typescript/src/lib/electrum/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { backoffRetrier, Hex, RetrierFn } from "../utils"
import MainnetElectrumUrls from "./urls/mainnet.json"
import TestnetElectrumUrls from "./urls/testnet.json"

const browserURL = window.URL
const URL = browserURL ?? nodeURL
const browserURL = typeof window !== 'undefined' && window.URL

Check failure on line 24 in typescript/src/lib/electrum/client.ts

View workflow job for this annotation

GitHub Actions / typescript-format

Replace `'undefined'` with `"undefined"`
const URL = nodeURL ?? browserURL

/**
* Represents a set of credentials required to establish an Electrum connection.
Expand Down

0 comments on commit 3ad8f4d

Please sign in to comment.