BlueWallet/shim.js

25 lines
788 B
JavaScript
Raw Normal View History

2018-03-17 20:33:00 +01:00
/* global __DEV__, localStorage */
global.net = require('react-native-tcp');
2018-03-17 21:39:21 +01:00
if (typeof __dirname === 'undefined') global.__dirname = '/';
if (typeof __filename === 'undefined') global.__filename = '';
2018-01-30 23:42:38 +01:00
if (typeof process === 'undefined') {
2018-03-17 21:39:21 +01:00
global.process = require('process');
2018-01-30 23:42:38 +01:00
} else {
2018-03-17 21:39:21 +01:00
const bProcess = require('process');
2018-01-30 23:42:38 +01:00
for (var p in bProcess) {
if (!(p in process)) {
2018-03-17 21:39:21 +01:00
process[p] = bProcess[p];
2018-01-30 23:42:38 +01:00
}
}
}
2018-03-17 21:39:21 +01:00
process.browser = false;
if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer;
2018-01-30 23:42:38 +01:00
// global.location = global.location || { port: 80 }
2018-03-17 21:39:21 +01:00
const isDev = typeof __DEV__ === 'boolean' && __DEV__;
process.env['NODE_ENV'] = isDev ? 'development' : 'production';
2018-01-30 23:42:38 +01:00
if (typeof localStorage !== 'undefined') {
2018-03-17 21:39:21 +01:00
localStorage.debug = isDev ? '*' : '';
2018-01-30 23:42:38 +01:00
}