| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | * @flow |
| 8 | */ |
| 9 | |
| 10 | import type {DevToolsHook} from 'react-devtools-shared/src/backend/types'; |
| 11 | |
| 12 | import Agent from 'react-devtools-shared/src/backend/agent'; |
| 13 | import Bridge from 'react-devtools-shared/src/bridge'; |
| 14 | import {initBackend} from 'react-devtools-shared/src/backend'; |
| 15 | import setupNativeStyleEditor from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor'; |
| 16 | |
| 17 | import {COMPACT_VERSION_NAME} from './utils'; |
| 18 | |
| 19 | setup(window.__REACT_DEVTOOLS_GLOBAL_HOOK__); |
| 20 | |
| 21 | function setup(hook: ?DevToolsHook) { |
| 22 | if (hook == null) { |
| 23 | return; |
| 24 | } |
| 25 | |
| 26 | hook.backends.set(COMPACT_VERSION_NAME, { |
| 27 | Agent, |
| 28 | Bridge, |
| 29 | initBackend, |
| 30 | setupNativeStyleEditor, |
| 31 | }); |
| 32 | |
| 33 | hook.emit('devtools-backend-installed', COMPACT_VERSION_NAME); |
| 34 | } |