Home / Function/ activate() — react Function Reference

activate() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e1996531_1f9f_9231_1f53_51768602c5c4["activate()"]
  354fe138_8fc9_c8a1_a2a8_b5eba888a4c5["backend.js"]
  e1996531_1f9f_9231_1f53_51768602c5c4 -->|defined in| 354fe138_8fc9_c8a1_a2a8_b5eba888a4c5
  cf14c8f7_70ff_92fb_fec3_36e531d5163e["startActivation()"]
  e1996531_1f9f_9231_1f53_51768602c5c4 -->|calls| cf14c8f7_70ff_92fb_fec3_36e531d5163e
  style e1996531_1f9f_9231_1f53_51768602c5c4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-inline/src/backend.js lines 77–117

export function activate(
  contentWindow: any,
  {
    bridge,
  }: {
    bridge?: BackendBridge,
  } = {},
): void {
  if (bridge == null) {
    bridge = createBridge(contentWindow);
  }

  startActivation(contentWindow, bridge);
}

export function createBridge(contentWindow: any, wall?: Wall): BackendBridge {
  const {parent} = contentWindow;

  if (wall == null) {
    wall = {
      listen(fn) {
        const onMessage = ({data}: $FlowFixMe) => {
          fn(data);
        };
        contentWindow.addEventListener('message', onMessage);
        return () => {
          contentWindow.removeEventListener('message', onMessage);
        };
      },
      send(event: string, payload: any, transferable?: Array<any>) {
        parent.postMessage({event, payload}, '*', transferable);
      },
    };
  }

  return (new Bridge(wall): BackendBridge);
}

export function initialize(contentWindow: any): void {
  installHook(contentWindow, componentFiltersPromise);
}

Domain

Subdomains

Frequently Asked Questions

What does activate() do?
activate() is a function in the react codebase, defined in packages/react-devtools-inline/src/backend.js.
Where is activate() defined?
activate() is defined in packages/react-devtools-inline/src/backend.js at line 77.
What does activate() call?
activate() calls 1 function(s): startActivation.

Analyze Your Own Codebase

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

Try Supermodel Free