Home / File/ TimelineContext.js — react Source File

TimelineContext.js — react Source File

Architecture documentation for TimelineContext.js, a javascript file in the react codebase. 4 imports, 3 dependents.

File javascript BabelCompiler 4 imports 3 dependents

Entity Profile

Dependency Diagram

graph LR
  7b213c28_1e91_ab50_3fbc_02eaee967af5["TimelineContext.js"]
  20cc2065_4b5b_fd6b_be12_28f36b0ff4cf["types.js"]
  7b213c28_1e91_ab50_3fbc_02eaee967af5 --> 20cc2065_4b5b_fd6b_be12_28f36b0ff4cf
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  7b213c28_1e91_ab50_3fbc_02eaee967af5 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  7b213c28_1e91_ab50_3fbc_02eaee967af5 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  7cd456b6_507e_98de_1e07_f65fc1623ee5["context"]
  7b213c28_1e91_ab50_3fbc_02eaee967af5 --> 7cd456b6_507e_98de_1e07_f65fc1623ee5
  d5e5a241_0d88_22ae_6561_9211ad78e796["CanvasPage.js"]
  d5e5a241_0d88_22ae_6561_9211ad78e796 --> 7b213c28_1e91_ab50_3fbc_02eaee967af5
  7fd04d1f_8e14_be78_275b_49d4237a927b["Timeline.js"]
  7fd04d1f_8e14_be78_275b_49d4237a927b --> 7b213c28_1e91_ab50_3fbc_02eaee967af5
  e3efee68_a282_ee12_670e_539a11c16f99["TimelineSearchInput.js"]
  e3efee68_a282_ee12_670e_539a11c16f99 --> 7b213c28_1e91_ab50_3fbc_02eaee967af5
  style 7b213c28_1e91_ab50_3fbc_02eaee967af5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type {ReactContext, RefObject} from 'shared/ReactTypes';

import * as React from 'react';
import {
  createContext,
  useContext,
  useMemo,
  useRef,
  useState,
  useSyncExternalStore,
} from 'react';
import {StoreContext} from 'react-devtools-shared/src/devtools/views/context';

import type {
  HorizontalScrollStateChangeCallback,
  TimelineData,
  SearchRegExpStateChangeCallback,
  ViewState,
  ReactEventInfo,
} from './types';

export type Context = {
  file: File | null,
  inMemoryTimelineData: Array<TimelineData> | null,
  isPerformanceTracksSupported: boolean,
  isTimelineSupported: boolean,
  searchInputContainerRef: RefObject,
  setFile: (file: File | null) => void,
  viewState: ViewState,
  selectEvent: ReactEventInfo => void,
  selectedEvent: ReactEventInfo,
};

const TimelineContext: ReactContext<Context> = createContext<Context>(
  ((null: any): Context),
);
TimelineContext.displayName = 'TimelineContext';

type Props = {
  children: React$Node,
};

function TimelineContextController({children}: Props): React.Node {
  const searchInputContainerRef = useRef(null);
  const [file, setFile] = useState<string | null>(null);

  const store = useContext(StoreContext);

  const isTimelineSupported = useSyncExternalStore<boolean>(
    function subscribe(callback) {
      store.addListener('rootSupportsTimelineProfiling', callback);
// ... (119 more lines)

Domain

Dependencies

Frequently Asked Questions

What does TimelineContext.js do?
TimelineContext.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does TimelineContext.js depend on?
TimelineContext.js imports 4 module(s): ReactTypes, context, react, types.js.
What files import TimelineContext.js?
TimelineContext.js is imported by 3 file(s): CanvasPage.js, Timeline.js, TimelineSearchInput.js.
Where is TimelineContext.js in the architecture?
TimelineContext.js is located at packages/react-devtools-timeline/src/TimelineContext.js (domain: BabelCompiler, directory: packages/react-devtools-timeline/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free