mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
RN: Migrate to ESM - ReactDevToolsSettingsManager (#51440)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51440 Migrates files to use ESM to mitigate the existing lint warning. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D74949984 fbshipit-source-id: e89eb482835cb3a3d3b997dc766803dd307a6b99
This commit is contained in:
committed by
Facebook GitHub Bot
parent
77f2cb27be
commit
3371fb57b7
+8
-9
@@ -4,17 +4,16 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @flow strict
|
||||
* @format
|
||||
*/
|
||||
|
||||
import NativeReactDevToolsSettingsManager from './specs/NativeReactDevToolsSettingsManager';
|
||||
|
||||
module.exports = {
|
||||
setGlobalHookSettings(settings: string) {
|
||||
NativeReactDevToolsSettingsManager?.setGlobalHookSettings(settings);
|
||||
},
|
||||
getGlobalHookSettings(): ?string {
|
||||
return NativeReactDevToolsSettingsManager?.getGlobalHookSettings();
|
||||
},
|
||||
};
|
||||
export function setGlobalHookSettings(settings: string) {
|
||||
NativeReactDevToolsSettingsManager?.setGlobalHookSettings(settings);
|
||||
}
|
||||
|
||||
export function getGlobalHookSettings(): ?string {
|
||||
return NativeReactDevToolsSettingsManager?.getGlobalHookSettings();
|
||||
}
|
||||
|
||||
+12
-15
@@ -12,19 +12,16 @@ import Settings from '../../../../Libraries/Settings/Settings';
|
||||
|
||||
const GLOBAL_HOOK_SETTINGS = 'ReactDevTools::HookSettings';
|
||||
|
||||
const ReactDevToolsSettingsManager = {
|
||||
setGlobalHookSettings(settings: string): void {
|
||||
Settings.set({
|
||||
[GLOBAL_HOOK_SETTINGS]: settings,
|
||||
});
|
||||
},
|
||||
getGlobalHookSettings(): ?string {
|
||||
const value = Settings.get(GLOBAL_HOOK_SETTINGS);
|
||||
if (typeof value === 'string') {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
};
|
||||
export function setGlobalHookSettings(settings: string) {
|
||||
Settings.set({
|
||||
[GLOBAL_HOOK_SETTINGS]: settings,
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = ReactDevToolsSettingsManager;
|
||||
export function getGlobalHookSettings(): ?string {
|
||||
const value = Settings.get(GLOBAL_HOOK_SETTINGS);
|
||||
if (typeof value === 'string') {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+3
-7
@@ -4,13 +4,9 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @flow strict
|
||||
* @format
|
||||
*/
|
||||
|
||||
declare const ReactDevToolsSettingsManager: {
|
||||
setGlobalHookSettings(settings: string): void,
|
||||
getGlobalHookSettings(): ?string,
|
||||
};
|
||||
|
||||
module.exports = ReactDevToolsSettingsManager;
|
||||
declare export function setGlobalHookSettings(settings: string): void;
|
||||
declare export function getGlobalHookSettings(): ?string;
|
||||
|
||||
Reference in New Issue
Block a user