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

Function inject

packages/react-devtools-shared/src/hook.js:206–237  ·  view source on GitHub ↗
(renderer: ReactRenderer)

Source from the content-addressed store, hash-verified

204 const isProfiling = shouldStartProfilingNow;
205 let uidCounter = 0;
206 function inject(renderer: ReactRenderer): number {
207 const id = ++uidCounter;
208 renderers.set(id, renderer);
209
210 const reactBuildType = hasDetectedBadDCE
211 ? 'deadcode'
212 : detectReactBuildType(renderer);
213
214 hook.emit('renderer', {
215 id,
216 renderer,
217 reactBuildType,
218 });
219
220 const rendererInterface = attachRenderer(
221 hook,
222 id,
223 renderer,
224 target,
225 isProfiling,
226 profilingSettings,
227 );
228 if (rendererInterface != null) {
229 hook.rendererInterfaces.set(id, rendererInterface);
230 hook.emit('renderer-attached', {id, rendererInterface});
231 } else {
232 hook.hasUnsupportedRendererAttached = true;
233 hook.emit('unsupported-renderer-version');
234 }
235
236 return id;
237 }
238
239 let hasDetectedBadDCE = false;
240

Callers 1

console-test.jsFile · 0.50

Calls 4

detectReactBuildTypeFunction · 0.85
attachRendererFunction · 0.85
setMethod · 0.80
emitMethod · 0.45

Tested by

no test coverage detected