MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / createSetting

Method createSetting

front_end/core/common/Settings.ts:212–220  ·  view source on GitHub ↗

* Get setting via key, and create a new setting if the requested setting does not exist. * @param key kebab-case string ID * @param defaultValue * @param storageType If not specified, SettingStorageType.GLOBAL is used.

(key: string, defaultValue: T, storageType?: SettingStorageType)

Source from the content-addressed store, hash-verified

210 * @param storageType If not specified, SettingStorageType.GLOBAL is used.
211 */
212 createSetting<T>(key: string, defaultValue: T, storageType?: SettingStorageType): Setting<T> {
213 const storage = this.storageFromType(storageType);
214 let setting = this.#registry.get(key) as Setting<T>;
215 if (!setting) {
216 setting = new Setting(key, defaultValue, this.#eventSupport, storage, this.#console, this.#logSettingAccess);
217 this.#registry.set(key, setting);
218 }
219 return setting;
220 }
221
222 createLocalSetting<T>(key: string, defaultValue: T): Setting<T> {
223 return this.createSetting(key, defaultValue, SettingStorageType.LOCAL);

Callers 15

constructorMethod · 0.95
createLocalSettingMethod · 0.95
createSettingsFunction · 0.80
gotPreferencesFunction · 0.80
isUnderTestFunction · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
getSettingFunction · 0.80
constructorMethod · 0.80
constructorMethod · 0.80

Calls 3

storageFromTypeMethod · 0.95
getMethod · 0.65
setMethod · 0.65

Tested by 8

getSettingFunction · 0.64
createNetworkLogViewFunction · 0.64
createSettingFunction · 0.64
setStarterBadgeDismissedFunction · 0.64