Files
react-native/Libraries/Utilities/PerformanceLoggerContext.js
T
Alexey Lang a9b3ca7fa7 Use global or scoped performance loggers everywhere
Summary:
I'm changing all callsites to use either global or scoped perf logger explicitly in one diff.
`GlobalPerformanceLogger` is basically a singleton
`scopedPerformanceLogger` is scoped to the React tree by using a React Context

Reviewed By: sahrens

Differential Revision: D14186694

fbshipit-source-id: 062c76eea8fce9d9b531f0eddf153bb79d52f68d
2019-03-06 09:51:56 -08:00

28 lines
854 B
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.
*
* @flow
* @format
*/
'use strict';
import * as React from 'react';
import GlobalPerformanceLogger from 'GlobalPerformanceLogger';
import type {IPerformanceLogger} from 'createPerformanceLogger';
/**
* 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 everywhere in your components.
* See React docs about using Context: https://reactjs.org/docs/context.html
*/
const PerformanceLoggerContext: React.Context<
IPerformanceLogger,
> = React.createContext(GlobalPerformanceLogger);
module.exports = PerformanceLoggerContext;