Home / File/ useEditorURL.js — react Source File

useEditorURL.js — react Source File

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

File javascript BabelCompiler Validation 3 imports 3 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  92c8d128_26b7_05c1_1f27_a9a5ab236fc6["useEditorURL.js"]
  0de29888_ca49_eb3c_33f7_ab4fff46de0b["utils.js"]
  92c8d128_26b7_05c1_1f27_a9a5ab236fc6 --> 0de29888_ca49_eb3c_33f7_ab4fff46de0b
  bcb71f5e_1ecf_5620_9a9e_55d6ab61dd1f["constants.js"]
  92c8d128_26b7_05c1_1f27_a9a5ab236fc6 --> bcb71f5e_1ecf_5620_9a9e_55d6ab61dd1f
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  92c8d128_26b7_05c1_1f27_a9a5ab236fc6 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  4c0d725a_27bd_a723_3599_a3e75bea5bd3["InspectedElement.js"]
  4c0d725a_27bd_a723_3599_a3e75bea5bd3 --> 92c8d128_26b7_05c1_1f27_a9a5ab236fc6
  6b10ae9e_a560_a310_ddb0_99f0d8e5ab0c["EditorPane.js"]
  6b10ae9e_a560_a310_ddb0_99f0d8e5ab0c --> 92c8d128_26b7_05c1_1f27_a9a5ab236fc6
  4d6a124e_fdc4_9da9_8ac7_85f75cd106fe["useOpenResource.js"]
  4d6a124e_fdc4_9da9_8ac7_85f75cd106fe --> 92c8d128_26b7_05c1_1f27_a9a5ab236fc6
  style 92c8d128_26b7_05c1_1f27_a9a5ab236fc6 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 {useCallback, useSyncExternalStore} from 'react';

import {getOpenInEditorURL} from '../../utils';
import {
  LOCAL_STORAGE_OPEN_IN_EDITOR_URL,
  LOCAL_STORAGE_OPEN_IN_EDITOR_URL_PRESET,
} from '../../constants';

const useEditorURL = (): string => {
  const editorURL = useSyncExternalStore(
    useCallback(function subscribe(callback) {
      window.addEventListener(LOCAL_STORAGE_OPEN_IN_EDITOR_URL, callback);
      window.addEventListener(
        LOCAL_STORAGE_OPEN_IN_EDITOR_URL_PRESET,
        callback,
      );
      return function unsubscribe() {
        window.removeEventListener(LOCAL_STORAGE_OPEN_IN_EDITOR_URL, callback);
        window.removeEventListener(
          LOCAL_STORAGE_OPEN_IN_EDITOR_URL_PRESET,
          callback,
        );
      };
    }, []),
    getOpenInEditorURL,
  );
  return editorURL;
};

export default useEditorURL;

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does useEditorURL.js do?
useEditorURL.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 useEditorURL.js?
useEditorURL.js defines 1 function(s): useEditorURL.
What does useEditorURL.js depend on?
useEditorURL.js imports 3 module(s): constants.js, react, utils.js.
What files import useEditorURL.js?
useEditorURL.js is imported by 3 file(s): EditorPane.js, InspectedElement.js, useOpenResource.js.
Where is useEditorURL.js in the architecture?
useEditorURL.js is located at packages/react-devtools-shared/src/devtools/views/useEditorURL.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views).

Analyze Your Own Codebase

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

Try Supermodel Free