(internals)
| 7262 | } |
| 7263 | |
| 7264 | function injectInternals(internals) { |
| 7265 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { |
| 7266 | // No DevTools |
| 7267 | return false; |
| 7268 | } |
| 7269 | var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; |
| 7270 | if (hook.isDisabled) { |
| 7271 | // This isn't a real property on the hook, but it can be set to opt out |
| 7272 | // of DevTools integration and associated warnings and logs. |
| 7273 | // https://github.com/facebook/react/issues/3877 |
| 7274 | return true; |
| 7275 | } |
| 7276 | if (!hook.supportsFiber) { |
| 7277 | { |
| 7278 | 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'); |
| 7279 | } |
| 7280 | // DevTools exists, even though it doesn't support Fiber. |
| 7281 | return true; |
| 7282 | } |
| 7283 | try { |
| 7284 | var rendererID = hook.inject(internals); |
| 7285 | // We have successfully injected, so now it is safe to set up hooks. |
| 7286 | onCommitFiberRoot = catchErrors(function (root) { |
| 7287 | return hook.onCommitFiberRoot(rendererID, root); |
| 7288 | }); |
| 7289 | onCommitFiberUnmount = catchErrors(function (fiber) { |
| 7290 | return hook.onCommitFiberUnmount(rendererID, fiber); |
| 7291 | }); |
| 7292 | } catch (err) { |
| 7293 | // Catch all errors because it is unsafe to throw during initialization. |
| 7294 | { |
| 7295 | warning(false, 'React DevTools encountered an error: %s.', err); |
| 7296 | } |
| 7297 | } |
| 7298 | // DevTools exists |
| 7299 | return true; |
| 7300 | } |
| 7301 | |
| 7302 | function onCommitRoot(root) { |
| 7303 | if (typeof onCommitFiberRoot === 'function') { |
no test coverage detected