Home / Function/ handleMessageFromPage() — react Function Reference

handleMessageFromPage() — react Function Reference

Architecture documentation for the handleMessageFromPage() function in proxy.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  67d3d2a3_daa4_6447_c5b2_93ef0d9b5c1c["handleMessageFromPage()"]
  668e31ea_eaa7_3604_a571_2b6a67d82b6c["proxy.js"]
  67d3d2a3_daa4_6447_c5b2_93ef0d9b5c1c -->|defined in| 668e31ea_eaa7_3604_a571_2b6a67d82b6c
  style 67d3d2a3_daa4_6447_c5b2_93ef0d9b5c1c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-extensions/src/contentScripts/proxy.js lines 70–97

function handleMessageFromPage(event: any) {
  if (event.source !== window || !event.data) {
    return;
  }

  switch (event.data.source) {
    // This is a message from a bridge (initialized by a devtools backend)
    case 'react-devtools-bridge': {
      backendInitialized = true;

      // $FlowFixMe[incompatible-use]
      port.postMessage(event.data.payload);
      break;
    }

    // This is a message from the backend manager, which runs in ExecutionWorld.MAIN
    // and can't use `chrome.runtime.sendMessage`
    case 'react-devtools-backend-manager': {
      const {source, payload} = event.data;

      chrome.runtime.sendMessage({
        source,
        payload,
      });
      break;
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does handleMessageFromPage() do?
handleMessageFromPage() is a function in the react codebase, defined in packages/react-devtools-extensions/src/contentScripts/proxy.js.
Where is handleMessageFromPage() defined?
handleMessageFromPage() is defined in packages/react-devtools-extensions/src/contentScripts/proxy.js at line 70.

Analyze Your Own Codebase

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

Try Supermodel Free