Highlighter.js — react Source File
Architecture documentation for Highlighter.js, a javascript file in the react codebase. 5 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 637d6ae2_3589_aafb_1b83_9f14bbf636ac["Highlighter.js"] 0304bbc8_f110_6643_71c6_d26bddc58fde["types.js"] 637d6ae2_3589_aafb_1b83_9f14bbf636ac --> 0304bbc8_f110_6643_71c6_d26bddc58fde 5b39fc3a_1731_1aaf_f727_b3222027f445["Overlay.js"] 637d6ae2_3589_aafb_1b83_9f14bbf636ac --> 5b39fc3a_1731_1aaf_f727_b3222027f445 76519fd3_f246_fb28_c5c7_e3e31c4d0bc6["Overlay"] 637d6ae2_3589_aafb_1b83_9f14bbf636ac --> 76519fd3_f246_fb28_c5c7_e3e31c4d0bc6 7812cbae_0bd0_497c_0a05_31fe0a8d0fde["agent"] 637d6ae2_3589_aafb_1b83_9f14bbf636ac --> 7812cbae_0bd0_497c_0a05_31fe0a8d0fde 80162ac2_4fc9_259b_04e9_4acc940af136["utils"] 637d6ae2_3589_aafb_1b83_9f14bbf636ac --> 80162ac2_4fc9_259b_04e9_4acc940af136 5f7af8e4_c9b4_4304_fda4_1cd7083e24d7["index.js"] 5f7af8e4_c9b4_4304_fda4_1cd7083e24d7 --> 637d6ae2_3589_aafb_1b83_9f14bbf636ac style 637d6ae2_3589_aafb_1b83_9f14bbf636ac 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 Agent from 'react-devtools-shared/src/backend/agent';
import type {HostInstance} from '../../types';
import {isReactNativeEnvironment} from 'react-devtools-shared/src/backend/utils';
import Overlay from './Overlay';
const SHOW_DURATION = 2000;
let timeoutID: TimeoutID | null = null;
let overlay: Overlay | null = null;
function hideOverlayNative(agent: Agent): void {
agent.emit('hideNativeHighlight');
}
function hideOverlayWeb(): void {
timeoutID = null;
if (overlay !== null) {
overlay.remove();
overlay = null;
}
}
export function hideOverlay(agent: Agent): void {
return isReactNativeEnvironment()
? hideOverlayNative(agent)
: hideOverlayWeb();
}
function showOverlayNative(
elements: $ReadOnlyArray<HostInstance>,
agent: Agent,
): void {
agent.emit('showNativeHighlight', elements);
}
function showOverlayWeb(
elements: $ReadOnlyArray<HTMLElement>,
componentName: string | null,
agent: Agent,
hideAfterTimeout: boolean,
): void {
if (timeoutID !== null) {
clearTimeout(timeoutID);
}
if (overlay === null) {
overlay = new Overlay(agent);
}
overlay.inspect(elements, componentName);
if (hideAfterTimeout) {
timeoutID = setTimeout(() => hideOverlay(agent), SHOW_DURATION);
}
}
export function showOverlay(
elements: $ReadOnlyArray<HostInstance>,
componentName: string | null,
agent: Agent,
hideAfterTimeout: boolean,
): void {
return isReactNativeEnvironment()
? showOverlayNative(elements, agent)
: showOverlayWeb(
(elements: $ReadOnlyArray<any>),
componentName,
agent,
hideAfterTimeout,
);
}
Domain
Subdomains
Functions
Dependencies
- Overlay
- Overlay.js
- agent
- types.js
- utils
Source
Frequently Asked Questions
What does Highlighter.js do?
Highlighter.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in Highlighter.js?
Highlighter.js defines 6 function(s): hideOverlay, hideOverlayNative, hideOverlayWeb, showOverlay, showOverlayNative, showOverlayWeb.
What does Highlighter.js depend on?
Highlighter.js imports 5 module(s): Overlay, Overlay.js, agent, types.js, utils.
What files import Highlighter.js?
Highlighter.js is imported by 1 file(s): index.js.
Where is Highlighter.js in the architecture?
Highlighter.js is located at packages/react-devtools-shared/src/backend/views/Highlighter/Highlighter.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/backend/views/Highlighter).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free