MCPcopy Create free account
hub / github.com/microsoft/SandDance / injectInternals

Function injectInternals

docs/external/js/react-dom.development.js:23584–23672  ·  view source on GitHub ↗
(internals)

Source from the content-addressed store, hash-verified

23582 var hasLoggedError = false;
23583 var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
23584 function injectInternals(internals) {
23585 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
23586 // No DevTools
23587 return false;
23588 }
23589
23590 var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
23591
23592 if (hook.isDisabled) {
23593 // This isn't a real property on the hook, but it can be set to opt out
23594 // of DevTools integration and associated warnings and logs.
23595 // https://github.com/facebook/react/issues/3877
23596 return true;
23597 }
23598
23599 if (!hook.supportsFiber) {
23600 {
23601 error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
23602 } // DevTools exists, even though it doesn't support Fiber.
23603
23604
23605 return true;
23606 }
23607
23608 try {
23609 var rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks.
23610
23611 if (true) {
23612 // Only used by Fast Refresh
23613 if (typeof hook.onScheduleFiberRoot === 'function') {
23614 onScheduleFiberRoot = function (root, children) {
23615 try {
23616 hook.onScheduleFiberRoot(rendererID, root, children);
23617 } catch (err) {
23618 if (true && !hasLoggedError) {
23619 hasLoggedError = true;
23620
23621 error('React instrumentation encountered an error: %s', err);
23622 }
23623 }
23624 };
23625 }
23626 }
23627
23628 onCommitFiberRoot = function (root, expirationTime) {
23629 try {
23630 var didError = (root.current.effectTag & DidCapture) === DidCapture;
23631
23632 if (enableProfilerTimer) {
23633 var currentTime = getCurrentTime();
23634 var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
23635 hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
23636 } else {
23637 hook.onCommitFiberRoot(rendererID, root, undefined, didError);
23638 }
23639 } catch (err) {
23640 if (true) {
23641 if (!hasLoggedError) {

Callers 1

injectIntoDevToolsFunction · 0.85

Calls 3

getCurrentTimeFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected