(internals)
| 6485 | } |
| 6486 | |
| 6487 | function injectInternals(internals) { |
| 6488 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { |
| 6489 | // No DevTools |
| 6490 | return false; |
| 6491 | } |
| 6492 | var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; |
| 6493 | if (hook.isDisabled) { |
| 6494 | // This isn't a real property on the hook, but it can be set to opt out |
| 6495 | // of DevTools integration and associated warnings and logs. |
| 6496 | // https://github.com/facebook/react/issues/3877 |
| 6497 | return true; |
| 6498 | } |
| 6499 | if (!hook.supportsFiber) { |
| 6500 | { |
| 6501 | warning(false, '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'); |
| 6502 | } |
| 6503 | // DevTools exists, even though it doesn't support Fiber. |
| 6504 | return true; |
| 6505 | } |
| 6506 | try { |
| 6507 | var rendererID = hook.inject(internals); |
| 6508 | // We have successfully injected, so now it is safe to set up hooks. |
| 6509 | onCommitFiberRoot = catchErrors(function (root) { |
| 6510 | return hook.onCommitFiberRoot(rendererID, root); |
| 6511 | }); |
| 6512 | onCommitFiberUnmount = catchErrors(function (fiber) { |
| 6513 | return hook.onCommitFiberUnmount(rendererID, fiber); |
| 6514 | }); |
| 6515 | } catch (err) { |
| 6516 | // Catch all errors because it is unsafe to throw during initialization. |
| 6517 | { |
| 6518 | warning(false, 'React DevTools encountered an error: %s.', err); |
| 6519 | } |
| 6520 | } |
| 6521 | // DevTools exists |
| 6522 | return true; |
| 6523 | } |
| 6524 | |
| 6525 | function onCommitRoot(root) { |
| 6526 | if (typeof onCommitFiberRoot === 'function') { |
no test coverage detected