mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 13:25:51 +08:00
Summary: This is the first diff in an effort to remove Geolocation from React Native. This diff removes the globally injected navigator.geolocation feature and instead requires explicit importing of `Geolocation`. When using Web APIs, people will need to patch `navigator.geolocation` on their own from now on. Reviewed By: sahrens Differential Revision: D14692386 fbshipit-source-id: c57b290b49728101250d726d67b1956ff23a9a92
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow
|
|
*/
|
|
|
|
/* globals window: true */
|
|
|
|
/**
|
|
* Sets up global variables typical in most JavaScript environments.
|
|
*
|
|
* 1. Global timers (via `setTimeout` etc).
|
|
* 2. Global console object.
|
|
* 3. Hooks for printing stack traces with source maps.
|
|
*
|
|
* Leaves enough room in the environment for implementing your own:
|
|
*
|
|
* 1. Require system.
|
|
* 2. Bridged modules.
|
|
*
|
|
*/
|
|
'use strict';
|
|
|
|
const start = Date.now();
|
|
|
|
require('setUpGlobals');
|
|
require('polyfillES6Collections');
|
|
require('setUpSystrace');
|
|
require('setUpErrorHandling');
|
|
require('checkNativeVersion');
|
|
require('polyfillPromise');
|
|
require('setUpRegeneratorRuntime');
|
|
require('setUpTimers');
|
|
require('setUpXHR');
|
|
require('setUpAlert');
|
|
require('setUpNavigator');
|
|
require('setUpBatchedBridge');
|
|
require('setUpSegmentFetcher');
|
|
if (__DEV__) {
|
|
require('setUpDeveloperTools');
|
|
}
|
|
|
|
const GlobalPerformanceLogger = require('GlobalPerformanceLogger');
|
|
// We could just call GlobalPerformanceLogger.markPoint at the top of the file,
|
|
// but then we'd be excluding the time it took to require the logger.
|
|
// Instead, we just use Date.now and backdate the timestamp.
|
|
GlobalPerformanceLogger.markPoint(
|
|
'initializeCore_start',
|
|
GlobalPerformanceLogger.currentTimestamp() - (Date.now() - start),
|
|
);
|
|
GlobalPerformanceLogger.markPoint('initializeCore_end');
|