Remove browser.ts global reference (#856)

* Remove browser.ts global reference

* fallback text

* formatting

* Additional formatting

* global > self > window > this

* Add x-global package

* Update tests

* Correct jest mapping
This commit is contained in:
Jaco Greeff
2021-01-24 15:58:42 +01:00
committed by GitHub
parent bbc752e475
commit 3804123ca6
25 changed files with 136 additions and 66 deletions
+5 -3
View File
@@ -1,8 +1,10 @@
// Copyright 2017-2021 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { xglobal } from '@polkadot/x-global';
import { TextDecoder as Fallback } from './fallback';
export const TextDecoder = typeof global.TextDecoder === 'undefined'
? Fallback as unknown as typeof global.TextDecoder
: global.TextDecoder;
export const TextDecoder = typeof xglobal.TextDecoder === 'undefined'
? Fallback as unknown as typeof xglobal.TextDecoder
: xglobal.TextDecoder;