UNPKG

1.49 kBJavaScriptView Raw
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'use strict';
27
28const start = Date.now();
29
30require('setUpGlobals');
31require('polyfillES6Collections');
32require('setUpSystrace');
33require('setUpErrorHandling');
34require('checkNativeVersion');
35require('polyfillPromise');
36require('setUpRegeneratorRuntime');
37require('setUpTimers');
38require('setUpXHR');
39require('setUpAlert');
40require('setUpGeolocation');
41require('setUpBatchedBridge');
42require('setUpSegmentFetcher');
43if (__DEV__) {
44 require('setUpDeveloperTools');
45}
46
47const 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.
51PerformanceLogger.markPoint(
52 'initializeCore_start',
53 PerformanceLogger.currentTimestamp() - (Date.now() - start),
54);
55PerformanceLogger.markPoint('initializeCore_end');