Home / File/ useExtensionComponentsPanelVisibility.js — react Source File

useExtensionComponentsPanelVisibility.js — react Source File

Architecture documentation for useExtensionComponentsPanelVisibility.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript BabelCompiler Validation 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  9623aa84_a4dd_27fc_019b_f7dc6e8453ad["useExtensionComponentsPanelVisibility.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  9623aa84_a4dd_27fc_019b_f7dc6e8453ad --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  4077b620_5c59_61c2_0910_273f565da757["bridge"]
  9623aa84_a4dd_27fc_019b_f7dc6e8453ad --> 4077b620_5c59_61c2_0910_273f565da757
  style 9623aa84_a4dd_27fc_019b_f7dc6e8453ad 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 {useState, useEffect} from 'react';
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';

// Events that are prefixed with `extension` will only be emitted for the browser extension implementation.
// For other implementations, this hook will just return constant `true` value.
export function useExtensionComponentsPanelVisibility(
  bridge: FrontendBridge,
): boolean {
  const [isVisible, setIsVisible] = useState(true);

  useEffect(() => {
    function onPanelShown() {
      setIsVisible(true);
    }
    function onPanelHidden() {
      setIsVisible(false);
    }

    bridge.addListener('extensionComponentsPanelShown', onPanelShown);
    bridge.addListener('extensionComponentsPanelHidden', onPanelHidden);

    return () => {
      bridge.removeListener('extensionComponentsPanelShown', onPanelShown);
      bridge.removeListener('extensionComponentsPanelHidden', onPanelHidden);
    };
  }, [bridge]);

  return isVisible;
}

Domain

Subdomains

Dependencies

  • bridge
  • react

Frequently Asked Questions

What does useExtensionComponentsPanelVisibility.js do?
useExtensionComponentsPanelVisibility.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 useExtensionComponentsPanelVisibility.js?
useExtensionComponentsPanelVisibility.js defines 1 function(s): useExtensionComponentsPanelVisibility.
What does useExtensionComponentsPanelVisibility.js depend on?
useExtensionComponentsPanelVisibility.js imports 2 module(s): bridge, react.
Where is useExtensionComponentsPanelVisibility.js in the architecture?
useExtensionComponentsPanelVisibility.js is located at packages/react-devtools-shared/src/frontend/hooks/useExtensionComponentsPanelVisibility.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/frontend/hooks).

Analyze Your Own Codebase

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

Try Supermodel Free