Home / Function/ patchMessageChannel() — react Function Reference

patchMessageChannel() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5a4bf3d5_e4a3_b336_6db6_6c30351e37f2["patchMessageChannel()"]
  b4b4ffa5_162b_c949_ece9_cc2ed4d878d7["patchMessageChannel.js"]
  5a4bf3d5_e4a3_b336_6db6_6c30351e37f2 -->|defined in| b4b4ffa5_162b_c949_ece9_cc2ed4d878d7
  style 5a4bf3d5_e4a3_b336_6db6_6c30351e37f2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/jest/patchMessageChannel.js lines 3–21

export function patchMessageChannel() {
  global.MessageChannel = class {
    constructor() {
      const port1 = {
        onmesssage: () => {},
      };

      this.port1 = port1;

      this.port2 = {
        postMessage(msg) {
          setTimeout(() => {
            port1.onmessage(msg);
          }, 0);
        },
      };
    }
  };
}

Domain

Subdomains

Frequently Asked Questions

What does patchMessageChannel() do?
patchMessageChannel() is a function in the react codebase, defined in scripts/jest/patchMessageChannel.js.
Where is patchMessageChannel() defined?
patchMessageChannel() is defined in scripts/jest/patchMessageChannel.js at line 3.

Analyze Your Own Codebase

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

Try Supermodel Free