mirror of
https://github.com/status-im/react-native.git
synced 2025-01-29 18:54:58 +00:00
Inline require ExceptionsManager dependencies
Summary: Inline require `ExceptionsManager` dependencies which are eagerly loaded on app startup (via `setUpConsole()` which is called from `InitializeJavaScriptAppEngine.js`) even though it's necessary until an exception needs to be reported. This can save about 30-40ms on an iOS device. public Reviewed By: nicklockwood, tadeuzagallo, jspahrsummers Differential Revision: D2755161 fb-gh-sync-id: d4cbfebf04d861b3a70558346a395d3d3ee87cc6
This commit is contained in:
parent
809627379b
commit
1304e78136
@ -11,12 +11,6 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var RCTExceptionsManager = require('NativeModules').ExceptionsManager;
|
||||
|
||||
var loadSourceMap = require('loadSourceMap');
|
||||
var parseErrorStack = require('parseErrorStack');
|
||||
var stringifySafe = require('stringifySafe');
|
||||
|
||||
var sourceMapPromise;
|
||||
|
||||
var exceptionID = 0;
|
||||
@ -25,6 +19,10 @@ var exceptionID = 0;
|
||||
* Handles the developer-visible aspect of errors and exceptions
|
||||
*/
|
||||
function reportException(e: Error, isFatal: bool) {
|
||||
var loadSourceMap = require('loadSourceMap');
|
||||
var parseErrorStack = require('parseErrorStack');
|
||||
var RCTExceptionsManager = require('NativeModules').ExceptionsManager;
|
||||
|
||||
var currentExceptionID = ++exceptionID;
|
||||
if (RCTExceptionsManager) {
|
||||
var stack = parseErrorStack(e);
|
||||
@ -83,6 +81,7 @@ function installConsoleErrorReporter() {
|
||||
if (arguments[0] && arguments[0].stack) {
|
||||
reportException(arguments[0], /* isFatal */ false);
|
||||
} else {
|
||||
var stringifySafe = require('stringifySafe');
|
||||
var str = Array.prototype.map.call(arguments, stringifySafe).join(', ');
|
||||
if (str.slice(0, 10) === '"Warning: ') {
|
||||
// React warnings use console.error so that a stack trace is shown, but
|
||||
|
Loading…
x
Reference in New Issue
Block a user