| 99 | * ContextProviders can subscribe to the Store for specific things they want to provide. |
| 100 | */ |
| 101 | export default class Store extends EventEmitter<{ |
| 102 | backendVersion: [], |
| 103 | collapseNodesByDefault: [], |
| 104 | componentFilters: [], |
| 105 | enableSuspenseTab: [], |
| 106 | error: [Error], |
| 107 | hookSettings: [$ReadOnly<DevToolsHookSettings>], |
| 108 | hostInstanceSelected: [Element['id']], |
| 109 | settingsUpdated: [$ReadOnly<DevToolsHookSettings>], |
| 110 | mutated: [[Array<Element['id']>, Map<Element['id'], Element['id']>]], |
| 111 | recordChangeDescriptions: [], |
| 112 | roots: [], |
| 113 | rootSupportsBasicProfiling: [], |
| 114 | rootSupportsTimelineProfiling: [], |
| 115 | suspenseTreeMutated: [[Map<SuspenseNode['id'], SuspenseNode['id']>]], |
| 116 | supportsNativeStyleEditor: [], |
| 117 | supportsReloadAndProfile: [], |
| 118 | unsupportedBridgeProtocolDetected: [], |
| 119 | unsupportedRendererVersionDetected: [], |
| 120 | }> { |
| 121 | // If the backend version is new enough to report its (NPM) version, this is it. |
| 122 | // This version may be displayed by the frontend for debugging purposes. |
| 123 | _backendVersion: string | null = null; |
| 124 | |
| 125 | _bridge: FrontendBridge; |
| 126 | |
| 127 | // Computed whenever _errorsAndWarnings Map changes. |
| 128 | _cachedComponentWithErrorCount: number = 0; |
| 129 | _cachedComponentWithWarningCount: number = 0; |
| 130 | _cachedErrorAndWarningTuples: ErrorAndWarningTuples | null = null; |
| 131 | |
| 132 | // Should new nodes be collapsed by default when added to the tree? |
| 133 | _collapseNodesByDefault: boolean = true; |
| 134 | |
| 135 | _componentFilters: Array<ComponentFilter>; |
| 136 | |
| 137 | // Map of ID to number of recorded error and warning message IDs. |
| 138 | _errorsAndWarnings: Map< |
| 139 | Element['id'], |
| 140 | {errorCount: number, warningCount: number}, |
| 141 | > = new Map(); |
| 142 | |
| 143 | // At least one of the injected renderers contains (DEV only) owner metadata. |
| 144 | _hasOwnerMetadata: boolean = false; |
| 145 | |
| 146 | // Map of ID to (mutable) Element. |
| 147 | // Elements are mutated to avoid excessive cloning during tree updates. |
| 148 | // The InspectedElement Suspense cache also relies on this mutability for its WeakMap usage. |
| 149 | _idToElement: Map<Element['id'], Element> = new Map(); |
| 150 | |
| 151 | _idToSuspense: Map<SuspenseNode['id'], SuspenseNode> = new Map(); |
| 152 | |
| 153 | // Should the React Native style editor panel be shown? |
| 154 | _isNativeStyleEditorSupported: boolean = false; |
| 155 | |
| 156 | _nativeStyleEditorValidAttributes: $ReadOnlyArray<string> | null = null; |
| 157 | |
| 158 | // Older backends don't support an explicit bridge protocol, |
nothing calls this directly
no test coverage detected