mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-30 23:22:41 +08:00
Improve constant inlining, add process.platform
Reviewed By: bestander Differential Revision: D3235716 fb-gh-sync-id: f9019ec0042827e409fa84ba74f4c426ccad1519 fbshipit-source-id: f9019ec0042827e409fa84ba74f4c426ccad1519
This commit is contained in:
committed by
Facebook Github Bot 6
parent
4e05d00f0d
commit
e6bafca39e
@@ -81,7 +81,7 @@ function polyfillLazyGlobal(name, valueFn, scope = GLOBAL) {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this[name] = valueFn();
|
||||
return (this[name] = valueFn());
|
||||
},
|
||||
set(value) {
|
||||
Object.defineProperty(this, name, {
|
||||
@@ -199,12 +199,14 @@ function setUpProfile() {
|
||||
}
|
||||
}
|
||||
|
||||
function setUpProcessEnv() {
|
||||
function setUpProcess() {
|
||||
GLOBAL.process = GLOBAL.process || {};
|
||||
GLOBAL.process.env = GLOBAL.process.env || {};
|
||||
if (!GLOBAL.process.env.NODE_ENV) {
|
||||
GLOBAL.process.env.NODE_ENV = __DEV__ ? 'development' : 'production';
|
||||
}
|
||||
|
||||
polyfillLazyGlobal('platform', () => require('Platform').OS, GLOBAL.process);
|
||||
}
|
||||
|
||||
function setUpDevTools() {
|
||||
@@ -217,7 +219,7 @@ function setUpDevTools() {
|
||||
}
|
||||
}
|
||||
|
||||
setUpProcessEnv();
|
||||
setUpProcess();
|
||||
setUpConsole();
|
||||
setUpTimers();
|
||||
setUpAlert();
|
||||
|
||||
Reference in New Issue
Block a user