Class Model
This class can be used to interact with the TableRealms model.
Hierarchy
Index
Methods
- AddListener
- GetData
- HasListener
- RemoveListener
- SetData
Methods
Static AddListener
AddListener(key: string, callback: function): string
- Defined in TableRealms.ts:81
- Adds a listener that is called whenever a value of a specific key is changed in the model.
Parameters
- key: string
- the model key for which to listen for changes.
- callback: function
- the callback that is called when the value of a key changes.
- (): void
- Returns void
- Returns string
- A string which is the combination of the key and the full callback signature.
Static GetData
GetData<T>(key: string): T
- Defined in TableRealms.ts:64
- A generic method to get data from the model. A type can be passed with GetData(key) to specify the return type.
Type parameters
T
Parameters
Static HasListener
HasListener(listenerId: string): boolean
- Defined in TableRealms.ts:95
- Determines if a key/callback combination exists based on a listenerID
Parameters
Static RemoveListener
RemoveListener(listenerId: string): void
- Defined in TableRealms.ts:88
- Removes a listener that that was added to a key based on a listenerID
Parameters
Static SetData
SetData<T>(key: string, value: T, forceUpdate: boolean): void
- Defined in TableRealms.ts:72
- A generic method to set data in the model. A type can be passed with SetData(key) to specify value type. Otherwise the value type is infered.
Type parameters
T
Parameters
- key: string
- value: T
- forceUpdate: boolean
- Specifies whether to force the sending of a model update message.
Returns void