1 | /**
|
2 | * Copyright (c) Facebook, Inc. and its affiliates.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | *
|
7 | * @format
|
8 | * @flow
|
9 | */
|
10 |
|
11 | /* globals window: true */
|
12 |
|
13 | /**
|
14 | * Sets up global variables typical in most JavaScript environments.
|
15 | *
|
16 | * 1. Global timers (via `setTimeout` etc).
|
17 | * 2. Global console object.
|
18 | * 3. Hooks for printing stack traces with source maps.
|
19 | *
|
20 | * Leaves enough room in the environment for implementing your own:
|
21 | *
|
22 | * 1. Require system.
|
23 | * 2. Bridged modules.
|
24 | *
|
25 | */
|
26 | ;
|
27 |
|
28 | const start = Date.now();
|
29 |
|
30 | require('setUpGlobals');
|
31 | require('polyfillES6Collections');
|
32 | require('setUpSystrace');
|
33 | require('setUpErrorHandling');
|
34 | require('checkNativeVersion');
|
35 | require('polyfillPromise');
|
36 | require('setUpRegeneratorRuntime');
|
37 | require('setUpTimers');
|
38 | require('setUpXHR');
|
39 | require('setUpAlert');
|
40 | require('setUpGeolocation');
|
41 | require('setUpBatchedBridge');
|
42 | require('setUpSegmentFetcher');
|
43 | if (__DEV__) {
|
44 | require('setUpDeveloperTools');
|
45 | }
|
46 |
|
47 | const PerformanceLogger = require('PerformanceLogger');
|
48 | // We could just call PerformanceLogger.markPoint at the top of the file,
|
49 | // but then we'd be excluding the time it took to require PerformanceLogger.
|
50 | // Instead, we just use Date.now and backdate the timestamp.
|
51 | PerformanceLogger.markPoint(
|
52 | 'initializeCore_start',
|
53 | PerformanceLogger.currentTimestamp() - (Date.now() - start),
|
54 | );
|
55 | PerformanceLogger.markPoint('initializeCore_end');
|