Class TJSGameSettings
Hierarchy
- TJSGameSettings (view full)
Index
Constructors
Accessors
Methods
Constructors
constructor
- new TJSGame
Settings (namespace): TJSGameSettings Creates the TJSGameSettings instance.
Parameters
- namespace: string
The namespace for all settings.
Returns TJSGameSettings
- namespace: string
Methods
data
- data(regex?): IterableIterator<GameSettingOptions, any, any>
Returns an iterable for the game setting data; GameSettingData.
Parameters
Optional
regex: RegExpOptional regular expression to filter by game setting keys.
Returns IterableIterator<GameSettingOptions, any, any>
Iterable iterator of GameSettingData.
entries
- entries<T>(regex?): IterableIterator<[string, Writable<T>], any, any>
Type Parameters
Parameters
Optional
regex: RegExpOptional regular expression to filter by game setting keys.
Returns IterableIterator<[string, Writable<T>], any, any>
Iterable iterator of keys and stores.
getReadableStore
getStore
getWritableStore
keys
- keys(regex?): IterableIterator<string, any, any>
Returns an iterable for the game setting keys from existing stores.
Parameters
Optional
regex: RegExpOptional regular expression to filter by game setting keys.
Returns IterableIterator<string, any, any>
Iterable iterator of game setting keys.
register
- register(setting, coreConfig?): Function
Registers a setting with TJSGameSettings and Foundry core.
Note: The specific store subscription handler assigned to the passed in store or store created for the setting internally is returned from this function. In some cases when setting up custom stores particularly of object types with several child property stores (
propertyStore
) it is necessary to only update the setting store and not all subscribers to the custom store as thepropertyStore
instances are also subscribers to the custom store.This allows the custom store in the
set
implementation to mainly only trigger the TJSGameSettings subscriber handler on updates and not all the connectedpropertyStore
instances.Parameters
- setting: GameSetting
A GameSetting instance to set to Foundry game settings.
Optional
coreConfig: booleanWhen false this overrides the
setting.options.config
parameter when registering the setting with Foundry. This allows the settings to be displayed in the app itself, but removed from the standard Foundry configuration location.
Returns Function
The specific store subscription handler assigned to the passed in store.
- setting: GameSetting
registerAll
- register
All (settings, coreConfig): {
[key: string]: Function;
} Registers multiple settings.
Please refer to the note in TJSGameSettings.register about the returned object of store subscriber handler functions.
Parameters
- settings: Iterable<GameSetting, any, any>
An iterable list of game setting configurations to register.
- coreConfig: boolean
When false this overrides the
setting.options.config
parameter when registering the setting with Foundry. This allows the settings to be displayed in the app itself, but removed from the standard Foundry configuration location.
Returns {
[key: string]: Function;
}An object containing all TJSGameSetting store subscriber handlers for each setting
key
added.[key: string]: Function
- settings: Iterable<GameSetting, any, any>
stores
- stores<T>(regex?): IterableIterator<Writable<T>, any, any>
Type Parameters
Parameters
Optional
regex: RegExpOptional regular expression to filter by game setting keys.
Returns IterableIterator<Writable<T>, any, any>
Iterable iterator of stores.
Registers game settings and creates a backing Svelte store for each setting. The Svelte store will update the Foundry game settings and vice versa when changes occur to the Foundry game settings the updated data is set to the store.
Note: It is possible to add multiple
onChange
callbacks on registration.TODO: A possible future extension is to offer type checking against the setting type by creating a customized writable store that has an overloaded
set
method to provide type checking.