Class TJSLiveGameSettings
Constructors
constructor
- new TJSLiveGameSettings(
gameSettings: TJSGameSettings,
options?: { exclude?: Set<string>; include?: Set<string> },
): TJSLiveGameSettings Creates a live binding against the setting stores. All settings are configured by default, but can also be filtered by setting key with inclusive / exclusive Sets.
Parameters
- gameSettings: TJSGameSettings
A game settings instance to subscribe to...
Optional
options: { exclude?: Set<string>; include?: Set<string> }TJSLiveGameSettings options.
Returns TJSLiveGameSettings
- gameSettings: TJSGameSettings
Methods
Protected
_update
destroy
entries
- entries(): IterableIterator<[key: string, value: any], any, any>
Returns an iterator / generator of all setting entries.
Returns IterableIterator<[key: string, value: any], any, any>
An iterator returning setting entries.
keys
- keys(): IterableIterator<string, any, any>
Returns an iterator / generator of all setting keys.
Returns IterableIterator<string, any, any>
An iterator returning setting keys.
subscribe
- subscribe(
handler: (value: TJSLiveGameSettings, key?: string) => void,
): Unsubscriber Parameters
- handler: (value: TJSLiveGameSettings, key?: string) => void
Callback function that is invoked on update / changes.
Returns Unsubscriber
Unsubscribe function.
- handler: (value: TJSLiveGameSettings, key?: string) => void
toString
values
- values(): IterableIterator<any, any, any>
Returns an iterator / generator of all values.
Returns IterableIterator<any, any, any>
An iterator returning setting values.
Provides an accessible JS object that is updated reactively from all or subset of TJSGameSettings stores. Accessors are provided to directly get / set current setting data. Using a setter will update the setting and backing store.
Note: You can create a JSDoc /
@typedef
to apply with@type
and achieve typing support in IDEs for the customizable live settings instance. Please see the example at the end of this source file on how to accomplish this task.TJSLiveGameSettings is also a readable Svelte store essentially providing a customizable derived store of all settings tracked.
Note: When using from JS a second subscriber function argument is the key that was updated. From Svelte: Use 'lastKey' accessor to retrieve the last updated key.