2019-02-28 14:35:59 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2019-12-06 02:58:55 +03:00
|
|
|
* @flow strict-local
|
2019-02-28 14:35:59 +03:00
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import * as React from 'react';
|
2019-05-08 18:44:25 +03:00
|
|
|
import GlobalPerformanceLogger from './GlobalPerformanceLogger';
|
|
|
|
import type {IPerformanceLogger} from './createPerformanceLogger';
|
2019-02-28 14:35:59 +03:00
|
|
|
|
2019-03-15 17:30:07 +03:00
|
|
|
/**
|
|
|
|
* This is a React Context that provides a scoped instance of IPerformanceLogger.
|
|
|
|
* We wrap every <AppContainer /> with a Provider for this context so the logger
|
|
|
|
* should be available in every component.
|
|
|
|
* See React docs about using Context: https://reactjs.org/docs/context.html
|
|
|
|
*/
|
2019-03-14 16:55:56 +03:00
|
|
|
const PerformanceLoggerContext: React.Context<IPerformanceLogger> = React.createContext(
|
|
|
|
GlobalPerformanceLogger,
|
|
|
|
);
|
2019-03-15 17:30:07 +03:00
|
|
|
module.exports = PerformanceLoggerContext;
|