Skip to content

editorGlobalsConfig

Class: Config

Offers static configuration values for the editor

Hierarchy

  • Config

Index

Methods

Methods

Static Private _applyConfig

_applyConfig(): void

Defined in src/util/config/Config.ts:617

Specify what config files are being used. Later files override the content of earlier ones, building up the overall configuration. Default is always used as the first file

Returns: void


Static Private _broadcastKeyChange

_broadcastKeyChange(key: string): void

Defined in src/util/config/Config.ts:554

Helper method to broadcast the new value of a specific key to all watchers. Also notifies "parent watchers", e.g. if something is watching a.b it gets notified if a.b.c changes as well. Notifies "child watchers", e.g. if a.b. changes then a watcher for a.b.c will get notified with the (possibly changed) value of c or null if c does not exist anymore.

Parameters:

Name Type
key string

Returns: void


Static Private _delete

_delete(key: ConfigKey): void

Defined in src/util/config/Config.ts:391

Deletes the given key from the config.

Parameters:

Name Type
key ConfigKey

Returns: void


Static Private _deleteDeep

_deleteDeep(object: any, keychain: string[], keychainIndex: number, deletedKeys: Set‹unknown›): boolean

Defined in src/util/config/Config.ts:454

Parameters:

Name Type Default
object any -
keychain string[] -
keychainIndex number 0
deletedKeys Set‹unknown› new Set()

Returns: boolean


Static Private _explodeKeyValueObject

_explodeKeyValueObject(key: string, value: any): object

Defined in src/util/config/Config.ts:374

Parameters:

Name Type
key string
value any

Returns: object


Static Private _getKeysRecursively

_getKeysRecursively(object: any, prefix: string, foundKeys: Set‹string›): Set‹string›

Defined in src/util/config/Config.ts:488

Parameters:

Name Type Default
object any -
prefix string ""
foundKeys Set‹string› new Set()

Returns: Set‹string›


Static Private _getLocalStorage

_getLocalStorage(): Storage

Defined in src/util/config/Config.ts:446

Returns: Storage


Static Private _getNameRecursively

_getNameRecursively(object: any, prefix: string): any

Defined in src/util/config/Config.ts:500

Parameters:

Name Type Default
object any -
prefix string ""

Returns: any


Static Private _getValueFromString

_getValueFromString(stringValue: string): any

Defined in src/util/config/Config.ts:581

Parameters:

Name Type
stringValue string

Returns: any


Static _initOnHashChangeListener

_initOnHashChangeListener(): void

Defined in src/util/config/Config.ts:222

Returns: void


Static _initOnTabexMessageListener

_initOnTabexMessageListener(): void

Defined in src/util/config/Config.ts:235

Returns: void


Static Private _loadConfigFile

_loadConfigFile(...filenames: string[]): void

Defined in src/util/config/Config.ts:481

Parameters:

Name Type
...filenames string[]

Returns: void


Static Private _loadPersistedConfig

_loadPersistedConfig(): void

Defined in src/util/config/Config.ts:428

Returns: void


Static Private _mergeConfigurations

_mergeConfigurations(configs: any[]): any

Defined in src/util/config/Config.ts:649

Given an array with configuration objects, merges them together and by this also deduplicates config values

Parameters:

Name Type
configs any[]

Returns: any


Static Private _persistConfig

_persistConfig(): boolean

Defined in src/util/config/Config.ts:399

Returns: boolean


Static Private _set

_set(key: string, value: any): void

Defined in src/util/config/Config.ts:511

Parameters:

Name Type
key string
value any

Returns: void


Static Private _setConfigRecursively

_setConfigRecursively(object: any, prefix: string): void

Defined in src/util/config/Config.ts:661

Parameters:

Name Type Default
object any -
prefix string ""

Returns: void


Static Private _unloadConfigFile

_unloadConfigFile(...filenames: string[]): void

Defined in src/util/config/Config.ts:609

Parameters:

Name Type
...filenames string[]

Returns: void


Static deletePersistent

deletePersistent(key: any): boolean

Defined in src/util/config/Config.ts:310

Deletes a key from the config, that was previously persisted to local storage. It does not delete a value from the general config and persist the fact that it was deleted.

Parameters:

Name Type Description
key any The key to delete.

Returns: boolean

Whether the data could be persisted


Static get

get(key: ConfigKey, defaultValue: ConfigValue): any

Defined in src/util/config/Config.ts:92

Returns a config value.

Parameters:

Name Type Default Description
key ConfigKey - - key of the config value. "." maps to subkey - "rendering.allowSleep" will return the allowSleep subObject of rendering.
defaultValue ConfigValue null - the default value that is being returned if the specified key was not found in the config Be aware that this uses call-by-reference on non-primitive types, so a change in the value object may lead to a change in the config.

Returns: any


Static getAndWatch

getAndWatchC›(key: ConfigKey, callback: function): C

Defined in src/util/config/Config.ts:193

Helper function to receive the value immediately when registering callback

Type parameters:

C: ConfigValue

Parameters:

key: ConfigKey

the key to be watched, e.g. "rendering.allowSleep"

callback: function

the callback that is being called with the changed value as argument

▸ (value: C): void

Parameters:

Name Type
value C

Returns: C

the current config value for the provided key Be aware that this uses call-by-reference on non-primitive types, so a change in the value object may lead to a change in the config.


Static getCurrentConfig

getCurrentConfig(): any

Defined in src/util/config/Config.ts:317

Returns: any


Static getDynamicConfig

getDynamicConfig(): (string | IConfigObject)[]

Defined in src/util/config/Config.ts:345

Returns: (string | IConfigObject)[]


Static getHashReader

getHashReader(): HashReader

Defined in src/util/config/Config.ts:337

Returns: HashReader


Static getKeys

getKeys(prefix: string): Set‹string›

Defined in src/util/config/Config.ts:370

Parameters:

Name Type Default
prefix string ""

Returns: Set‹string›


Static getPersistedConfig

getPersistedConfig(): IConfigObject[]

Defined in src/util/config/Config.ts:357

Returns: IConfigObject[]


Static getWatchers

getWatchers(): object

Defined in src/util/config/Config.ts:349

Returns: object


Static has

has(key: ConfigKey): boolean

Defined in src/util/config/Config.ts:132

Parameters:

Name Type
key ConfigKey

Returns: boolean


Static loadConfigFile

loadConfigFile(...filenames: string[]): void

Defined in src/util/config/Config.ts:246

Parameters:

Name Type
...filenames string[]

Returns: void


Static parseConfigFromWindowHash

parseConfigFromWindowHash(): void

Defined in src/util/config/Config.ts:203

Tries to read out the current window hash and extract the values into configuration

Returns: void


Static reset

reset(key: ConfigKey): void

Defined in src/util/config/Config.ts:119

Parameters:

Name Type
key ConfigKey

Returns: void


Static resetConfiguration

resetConfiguration(): void

Defined in src/util/config/Config.ts:256

Returns: void


Static resetPersistedConfig

resetPersistedConfig(): boolean

Defined in src/util/config/Config.ts:365

Resets the runtime persistedConfig and tries to also reset it in storage.

Returns: boolean

whether the persisted config in the local storage could be reset.


Static set

set(key: ConfigKey, value: ConfigValue | IConfigObject): void

Defined in src/util/config/Config.ts:114

Sets or overwrites a config value

Parameters:

Name Type Description
key ConfigKey - key of the config value. "." maps to subkey - "rendering.allowSleep" will set the (config.)rendering.allowSleep = value sub-object.
value ConfigValue | IConfigObject - the value to be set Be aware that this uses call-by-reference on non-primitive types, so a change in the value object may lead to a change in the config.

Returns: void


Static setAvailableConfigFiles

setAvailableConfigFiles(configFiles: any): void

Defined in src/util/config/Config.ts:325

Parameters:

Name Type
configFiles any

Returns: void


Static setBaseConfig

setBaseConfig(...config: string[]): void

Defined in src/util/config/Config.ts:283

Parameters:

Name Type
...config string[]

Returns: void


Static setCurrentConfig

setCurrentConfig(config: any): void

Defined in src/util/config/Config.ts:321

Parameters:

Name Type
config any

Returns: void


Static setDynamicConfig

setDynamicConfig(config: any): void

Defined in src/util/config/Config.ts:329

Parameters:

Name Type
config any

Returns: void


Static setHashConfig

setHashConfig(config: any): void

Defined in src/util/config/Config.ts:333

Parameters:

Name Type
config any

Returns: void


Static setHashReader

setHashReader(newHashReader: any): void

Defined in src/util/config/Config.ts:341

Parameters:

Name Type
newHashReader any

Returns: void


Static setPersistedConfig

setPersistedConfig(newPersistedConfig: IConfigObject[]): void

Defined in src/util/config/Config.ts:353

Parameters:

Name Type
newPersistedConfig IConfigObject[]

Returns: void


Static setPersistent

setPersistent(key: string, value: any): boolean

Defined in src/util/config/Config.ts:298

This method will Config.set the supplied value and persist it to local storage, so the value will be applied again at the beginning of the next session. Note: The value will always be updated, regardless of the return value. But it might not be persisted.

Parameters:

Name Type Description
key string -
value any - Be aware that this uses call-by-reference on non-primitive types, so a change in the value object may lead to a change in the config.

Returns: boolean

whether the value could be saved


Static unloadConfigFile

unloadConfigFile(...filenames: string[]): void

Defined in src/util/config/Config.ts:251

Parameters:

Name Type
...filenames string[]

Returns: void


Static unwatch

unwatch(key: ConfigKey, callback: function): void

Defined in src/util/config/Config.ts:172

Parameters:

key: ConfigKey

callback: function

▸ (value: ConfigValue): void

Parameters:

Name Type
value ConfigValue

Returns: void


Static watch

watchConfigValue›(key: ConfigKey, callback: function): void

Defined in src/util/config/Config.ts:156

Register a callback that is called when a specified key changes its value This only gets called on changes via setter functions of the config, not if a reference to an object is changed that was previously get from the config.

Type parameters:

ConfigValue

Parameters:

key: ConfigKey

the key to be watched, e.g. "rendering.allowSleep"

callback: function

the callback that is being called with the changed value as argument

▸ (value: ConfigValue): void

Parameters:

Name Type
value ConfigValue

Returns: void