-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathshim.js
25 lines (21 loc) · 891 Bytes
/
shim.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { polyfill as polyfillEncoding } from 'react-native-polyfill-globals/src/encoding'
import { polyfill as polyfillURL } from 'react-native-polyfill-globals/src/url'
import { polyfill as polyfillCrypto } from 'react-native-polyfill-globals/src/crypto'
import { polyfill as polyfillFetch } from 'react-native-polyfill-globals/src/fetch'
import { polyfill as polyfillReadableStream } from 'react-native-polyfill-globals/src/readable-stream'
polyfillEncoding()
polyfillReadableStream()
polyfillURL()
polyfillCrypto()
polyfillFetch()
if (typeof Buffer === 'undefined') {
// eslint-disable-next-line global-require
global.Buffer = require('buffer/').Buffer
}
// eslint-disable-next-line global-require
if (typeof BigInt === 'undefined') global.BigInt = require('big-integer')
if (!global.performance && global._chronoNow) {
global.performance = {
now: global._chronoNow,
};
}