mirror of https://github.com/status-im/metro.git
Don't call originalConsole methods when they don't exist
Reviewed By: @vjeux Differential Revision: D2485562
This commit is contained in:
parent
d4f9750e38
commit
c74f1e9bc9
|
@ -468,13 +468,17 @@
|
|||
// If available, also call the original `console` method since that is
|
||||
// sometimes useful. Ex: on OS X, this will let you see rich output in
|
||||
// the Safari Web Inspector console.
|
||||
Object.keys(global.console).forEach(methodName => {
|
||||
var reactNativeMethod = global.console[methodName];
|
||||
global.console[methodName] = function() {
|
||||
originalConsole[methodName](...arguments);
|
||||
reactNativeMethod.apply(global.console, arguments);
|
||||
};
|
||||
});
|
||||
if (__DEV__ && originalConsole) {
|
||||
Object.keys(global.console).forEach(methodName => {
|
||||
var reactNativeMethod = global.console[methodName];
|
||||
if (originalConsole[methodName]) {
|
||||
global.console[methodName] = function() {
|
||||
originalConsole[methodName](...arguments);
|
||||
reactNativeMethod.apply(global.console, arguments);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
|
|
Loading…
Reference in New Issue