Class ContextUpdateTracker
Definition
Namespace: StardewUI.Framework.Binding
Assembly: StardewUI.dll
Tracks context instances that already had updates dispatched this frame, to prevent duplication.
Inheritance
Object ⇦ ContextUpdateTracker
Remarks
Used by the ContextUpdatingNodeDecorator.
Members
Fields
Name | Description |
---|---|
Instance | Global instance for entire framework. |
Methods
Name | Description |
---|---|
Reset() | Resets all state; to be called at the beginning of each frame. |
TrackUpdate(Object) | Tracks the update of a context instance so that WasAlreadyUpdated(Object) returns true for the given contextData until Reset() is called. |
WasAlreadyUpdated(Object) | Checks if a context instance already received an update tick dispatch for the current frame. |
Details
Fields
Instance
Global instance for entire framework.
Field Value
Remarks
Entire view trees may share the same context data; this is entirely up to the client(s). Therefore, the same tracker instance must be shared by all nodes in order to prevent duplication.
The instance is expected to be reset in the ModEntry
or similar entry point.
Methods
Reset()
Resets all state; to be called at the beginning of each frame.
TrackUpdate(Object)
Tracks the update of a context instance so that WasAlreadyUpdated(Object) returns true
for the given contextData
until Reset() is called.
Parameters
contextData
Object
The context that was updated.
WasAlreadyUpdated(Object)
Checks if a context instance already received an update tick dispatch for the current frame.
Parameters
contextData
Object
The context that may have been previously updated.
Returns
true
if the contextData
already received an update tick, otherwise false
.