File tree Expand file tree Collapse file tree 4 files changed +26
-22
lines changed
Expand file tree Collapse file tree 4 files changed +26
-22
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33 return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
44} ;
55Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
6- const text_encoding_1 = require ( "text-encoding" ) ;
76require ( "react-native-url-polyfill/auto" ) ;
7+ require ( "fast-text-encoding" ) ;
88const cbor_js_1 = __importDefault ( require ( "cbor-js" ) ) ;
99const buffer_1 = require ( "buffer" ) ;
1010const stringify_buffer_keys_1 = require ( "../core/components/stringify_buffer_keys" ) ;
@@ -19,9 +19,7 @@ const LegacyCryptoModule_1 = __importDefault(require("../crypto/modules/LegacyCr
1919const pubnub_common_1 = require ( "../core/pubnub-common" ) ;
2020const configuration_2 = require ( "./configuration" ) ;
2121const common_1 = __importDefault ( require ( "../cbor/common" ) ) ;
22- // Polyfill global environment
23- global . TextEncoder = global . TextEncoder || text_encoding_1 . TextEncoder ;
24- global . TextDecoder = global . TextDecoder || text_encoding_1 . TextDecoder ;
22+ // Polyfill global Buffer for React Native environment
2523global . Buffer = global . Buffer || buffer_1 . Buffer ;
2624/**
2725 * PubNub client for React Native platform.
Original file line number Diff line number Diff line change 6060 "buffer" : " ^6.0.3" ,
6161 "cbor-js" : " ^0.1.0" ,
6262 "cbor-sync" : " ^1.0.4" ,
63+ "fast-text-encoding" : " ^1.0.6" ,
6364 "fflate" : " ^0.8.2" ,
6465 "form-data" : " ^4.0.4" ,
6566 "lil-uuid" : " ^0.1.1" ,
6667 "node-fetch" : " ^2.7.0" ,
6768 "proxy-agent" : " ^6.3.0" ,
68- "react-native-url-polyfill" : " ^2.0.0" ,
69- "text-encoding" : " ^0.7.0"
69+ "react-native-url-polyfill" : " ^2.0.0"
7070 },
7171 "devDependencies" : {
7272 "@rollup/plugin-commonjs" : " ^25.0.7" ,
7979 "@types/chai" : " ^4.3.14" ,
8080 "@types/chai-as-promised" : " ^7.1.8" ,
8181 "@types/expect" : " ^24.3.0" ,
82+ "@types/fast-text-encoding" : " ^1.0.3" ,
8283 "@types/lil-uuid" : " ^0.1.3" ,
8384 "@types/mocha" : " ^9.1.0" ,
8485 "@types/nock" : " ^9.3.1" ,
118119 "sinon" : " ^7.5.0" ,
119120 "sinon-chai" : " ^3.3.0" ,
120121 "source-map-support" : " ^0.5.21" ,
121- "ts-mocha" : " ^10.0.0" ,
122122 "ts-loader" : " ^9.5.2" ,
123+ "ts-mocha" : " ^10.0.0" ,
123124 "ts-node" : " ^10.9.2" ,
124125 "tsx" : " ^4.7.1" ,
125126 "typescript" : " ^5.4.5" ,
Original file line number Diff line number Diff line change 1- import { TextEncoder , TextDecoder } from 'text-encoding' ;
21import 'react-native-url-polyfill/auto' ;
2+ import 'fast-text-encoding' ;
33import CborReader from 'cbor-js' ;
44import { Buffer } from 'buffer' ;
55
@@ -29,9 +29,7 @@ export type {
2929} from '../core/components/retry-policy' ;
3030export type { PubNubConfiguration } ;
3131
32- // Polyfill global environment
33- global . TextEncoder = global . TextEncoder || TextEncoder ;
34- global . TextDecoder = global . TextDecoder || TextDecoder ;
32+ // Polyfill global Buffer for React Native environment
3533global . Buffer = global . Buffer || Buffer ;
3634
3735/**
You can’t perform that action at this time.
0 commit comments