MCPcopy Index your code
hub / github.com/react/react / logEvent

Function logEvent

packages/react-devtools-shared/src/registerDevToolsEventLogger.js:29–54  ·  view source on GitHub ↗
(event: LoggerEvent)

Source from the content-addressed store, hash-verified

27 | (() => Promise<LoggerContext>),
28): void {
29 async function logEvent(event: LoggerEvent) {
30 if (enableLogger) {
31 if (currentLoggingIFrame != null && currentSessionId != null) {
32 const {metadata, ...eventWithoutMetadata} = event;
33 const additionalContext: LoggerContext | {} =
34 fetchAdditionalContext != null ? await fetchAdditionalContext() : {};
35
36 currentLoggingIFrame?.contentWindow?.postMessage(
37 {
38 source: 'react-devtools-logging',
39 event: eventWithoutMetadata,
40 context: {
41 ...additionalContext,
42 metadata: metadata != null ? JSON.stringify(metadata) : '',
43 session_id: currentSessionId,
44 surface,
45 version: process.env.DEVTOOLS_VERSION,
46 },
47 },
48 '*',
49 );
50 } else {
51 missedEvents.push(event);
52 }
53 }
54 }
55
56 function handleLoggingIFrameLoaded(iframe: HTMLIFrameElement) {
57 currentLoggingIFrame = iframe;

Callers 15

handleLoadCompleteFunction · 0.90
ProfilerStoreClass · 0.90
DevTools.jsFile · 0.90
handleStopInspectingHostFunction · 0.90
handleClickFunction · 0.90
InspectHostNodesToggleFunction · 0.90
OwnerViewFunction · 0.90
useLocalStorageWithLogFunction · 0.90
ErrorBoundaryClass · 0.90
createComponentsPanelFunction · 0.90
createProfilerPanelFunction · 0.90

Calls 2

postMessageMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected