RCTDevSettings.h
2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <React/RCTBridge.h>
#import <React/RCTDefines.h>
@protocol RCTPackagerClientMethod;
/**
* An abstraction for a key-value store to manage RCTDevSettings behavior.
* The default implementation persists settings using NSUserDefaults.
*/
@protocol RCTDevSettingsDataSource <NSObject>
/**
* Updates the setting with the given key to the given value.
* How the data source's state changes depends on the implementation.
*/
- (void)updateSettingWithValue:(id)value forKey:(NSString *)key;
/**
* Returns the value for the setting with the given key.
*/
- (id)settingForKey:(NSString *)key;
@end
@interface RCTDevSettings : NSObject
- (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource;
@property (nonatomic, readonly) BOOL isHotLoadingAvailable;
@property (nonatomic, readonly) BOOL isLiveReloadAvailable;
@property (nonatomic, readonly) BOOL isRemoteDebuggingAvailable;
@property (nonatomic, readonly) BOOL isNuclideDebuggingAvailable;
@property (nonatomic, readonly) BOOL isJSCSamplingProfilerAvailable;
/**
* Whether the bridge is connected to a remote JS executor.
*/
@property (nonatomic, assign) BOOL isDebuggingRemotely;
/*
* Whether shaking will show RCTDevMenu. The menu is enabled by default if RCT_DEV=1, but
* you may wish to disable it so that you can provide your own shake handler.
*/
@property (nonatomic, assign) BOOL isShakeToShowDevMenuEnabled;
/**
* Whether performance profiling is enabled.
*/
@property (nonatomic, assign, setter=setProfilingEnabled:) BOOL isProfilingEnabled;
/**
* Whether automatic polling for JS code changes is enabled. Only applicable when
* running the app from a server.
*/
@property (nonatomic, assign, setter=setLiveReloadEnabled:) BOOL isLiveReloadEnabled;
/**
* Whether hot loading is enabled.
*/
@property (nonatomic, assign, setter=setHotLoadingEnabled:) BOOL isHotLoadingEnabled;
/**
* Toggle the element inspector.
*/
- (void)toggleElementInspector;
/**
* Toggle JSC's sampling profiler.
*/
- (void)toggleJSCSamplingProfiler;
/**
* Enables starting of profiling sampler on launch
*/
@property (nonatomic, assign) BOOL startSamplingProfilerOnLaunch;
/**
* Whether the element inspector is visible.
*/
@property (nonatomic, readonly) BOOL isElementInspectorShown;
/**
* Whether the performance monitor is visible.
*/
@property (nonatomic, assign) BOOL isPerfMonitorShown;
#if RCT_DEV
- (void)addHandler:(id<RCTPackagerClientMethod>)handler forPackagerMethod:(NSString *)name __deprecated_msg("Use RCTPackagerConnection directly instead");
#endif
@end
@interface RCTBridge (RCTDevSettings)
@property (nonatomic, readonly) RCTDevSettings *devSettings;
@end