* Remove browser.ts global reference * fallback text * formatting * Additional formatting * global > self > window > this * Add x-global package * Update tests * Correct jest mapping
11 lines
361 B
TypeScript
11 lines
361 B
TypeScript
// Copyright 2017-2021 @polkadot/x-textencoder authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import { xglobal } from '@polkadot/x-global';
|
|
|
|
import { TextEncoder as Fallback } from './fallback';
|
|
|
|
export const TextEncoder = typeof xglobal.TextEncoder === 'undefined'
|
|
? Fallback as unknown as typeof xglobal.TextEncoder
|
|
: xglobal.TextEncoder;
|