| 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 | |
| 8 | import {atom} from 'jotai'; |
| 9 | import serverAPI from '../ClientToServerAPI'; |
| 10 | import {atomWithOnChange, localStorageBackedAtom} from '../jotaiUtils'; |
| 11 | |
| 12 | export const enableReduxTools = localStorageBackedAtom<boolean>('isl.debug-redux-tools', false); |
| 13 | |
| 14 | export const enableReactTools = localStorageBackedAtom<boolean>('isl.debug-react-tools', false); |
| 15 | |
| 16 | export const enableSaplingDebugFlag = atomWithOnChange<boolean>( |
| 17 | atom(false), |
| 18 | enabled => { |
| 19 | serverAPI.postMessage({type: 'setDebugLogging', name: 'debug', enabled}); |
| 20 | }, |
| 21 | /* skipInitialCall */ true, |
| 22 | ); |
| 23 | |
| 24 | export const enableSaplingVerboseFlag = atomWithOnChange<boolean>( |
| 25 | atom(false), |
| 26 | enabled => { |
| 27 | serverAPI.postMessage({type: 'setDebugLogging', name: 'verbose', enabled}); |
| 28 | }, |
| 29 | /* skipInitialCall */ true, |
| 30 | ); |
| 31 | |