Home / Function/ fetchFromPage() — react Function Reference

fetchFromPage() — react Function Reference

Architecture documentation for the fetchFromPage() function in fetchFileWithCaching.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  d8e27196_681b_1e9c_e0ef_5d96abe58b82["fetchFromPage()"]
  8128576f_0171_0141_7371_cfb7e102597e["fetchFileWithCaching.js"]
  d8e27196_681b_1e9c_e0ef_5d96abe58b82 -->|defined in| 8128576f_0171_0141_7371_cfb7e102597e
  07cdcb7e_d08b_cea3_7731_755f443b7d3a["fetchFromNetworkCache()"]
  07cdcb7e_d08b_cea3_7731_755f443b7d3a -->|calls| d8e27196_681b_1e9c_e0ef_5d96abe58b82
  8288643d_dc4e_6c27_0a62_597f4b057516["debugLog()"]
  d8e27196_681b_1e9c_e0ef_5d96abe58b82 -->|calls| 8288643d_dc4e_6c27_0a62_597f4b057516
  style d8e27196_681b_1e9c_e0ef_5d96abe58b82 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-extensions/src/main/fetchFileWithCaching.js lines 93–125

const fetchFromPage = async (url, resolve, reject) => {
  debugLog('[main] fetchFromPage()', url);

  function onPortMessage({payload, source}) {
    if (source === 'react-devtools-background' && payload?.url === url) {
      switch (payload?.type) {
        case 'fetch-file-with-cache-complete':
          chrome.runtime.onMessage.removeListener(onPortMessage);
          resolve(payload.value);
          break;
        case 'fetch-file-with-cache-error':
          chrome.runtime.onMessage.removeListener(onPortMessage);
          reject(payload.value);
          break;
      }
    }
  }

  chrome.runtime.onMessage.addListener(onPortMessage);
  if (pendingFetchRequests.has(url)) {
    return;
  }

  pendingFetchRequests.add(url);
  chrome.runtime.sendMessage({
    source: 'devtools-page',
    payload: {
      type: 'fetch-file-with-cache',
      tabId: chrome.devtools.inspectedWindow.tabId,
      url,
    },
  });
};

Domain

Subdomains

Calls

Frequently Asked Questions

What does fetchFromPage() do?
fetchFromPage() is a function in the react codebase, defined in packages/react-devtools-extensions/src/main/fetchFileWithCaching.js.
Where is fetchFromPage() defined?
fetchFromPage() is defined in packages/react-devtools-extensions/src/main/fetchFileWithCaching.js at line 93.
What does fetchFromPage() call?
fetchFromPage() calls 1 function(s): debugLog.
What calls fetchFromPage()?
fetchFromPage() is called by 1 function(s): fetchFromNetworkCache.

Analyze Your Own Codebase

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

Try Supermodel Free