From 202f01ae2437ca66b86134797c7282cd42690e5a Mon Sep 17 00:00:00 2001 From: Stefanie Doll Date: Mon, 1 Apr 2019 15:45:35 +0200 Subject: [PATCH] Replace isUndefined util with explicit typeof check (#107) * compiled version of isUndefined util fails if a variable is not defined. * disable tslint on window check --- packages/ui-settings/src/defaults.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui-settings/src/defaults.ts b/packages/ui-settings/src/defaults.ts index 1198dbba..442e6499 100644 --- a/packages/ui-settings/src/defaults.ts +++ b/packages/ui-settings/src/defaults.ts @@ -2,12 +2,11 @@ // 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 = !isUndefined(window) && window.location.host.indexOf('polkadot') !== -1; + // tslint:disable-next-line +const isPolkadot = typeof window !== 'undefined' && window.location.host.indexOf('polkadot') !== -1; const WSS_POLKADOT = 'wss://poc3-rpc.polkadot.io/'; const WSS_SUBSTRATE = 'wss://substrate-rpc.parity.io/'; @@ -46,7 +45,8 @@ const UITHEME_DEFAULT = isPolkadot ? 'polkadot' : 'substrate'; -const UIMODE_DEFAULT = !isPolkadot && !isUndefined(window) && window.location.host.indexOf('ui-light') !== -1 +// tslint:disable-next-line +const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.indexOf('ui-light') !== -1 ? 'light' : 'full';