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 4c855ed
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
const URL = nodeURL ?? browserURL

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

0 comments on commit 4c855ed

Please sign in to comment.