mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-09 20:11:04 +00:00
Check if window object exists (#100)
* Check if window object exists * brackets for readability * change check to isUndefined() * isUndefined() -> !isUndefined()
This commit is contained in:
committed by
Jaco Greeff
parent
5a5200729f
commit
71a649c428
@@ -10,6 +10,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.3.4",
|
||||
"@polkadot/util": "^0.39.1",
|
||||
"@types/store": "^2.0.1",
|
||||
"store": "^2.0.12"
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { isUndefined } from '@polkadot/util';
|
||||
|
||||
import { Options } from './types';
|
||||
|
||||
// matches https://polkadot.js.org & https://poc-3.polkadot.io
|
||||
const isPolkadot = window.location.host.indexOf('polkadot') !== -1;
|
||||
const isPolkadot = !isUndefined(window) && window.location.host.indexOf('polkadot') !== -1;
|
||||
|
||||
const WSS_POLKADOT = 'wss://poc3-rpc.polkadot.io/';
|
||||
const WSS_SUBSTRATE = 'wss://substrate-rpc.parity.io/';
|
||||
@@ -44,7 +46,7 @@ const UITHEME_DEFAULT = isPolkadot
|
||||
? 'polkadot'
|
||||
: 'substrate';
|
||||
|
||||
const UIMODE_DEFAULT = !isPolkadot && window.location.host.indexOf('ui-light') !== -1
|
||||
const UIMODE_DEFAULT = !isPolkadot && !isUndefined(window) && window.location.host.indexOf('ui-light') !== -1
|
||||
? 'light'
|
||||
: 'full';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user