Class PropChangeTracker<T, K>
Type Parameters
Index
Constructors
constructor
-
new PropChangeTracker<
T extends object,
K extends string | number | symbol = keyof T,
>(
options: PropChangeTracker.Options<T, K>,
): PropChangeTracker<T, K>Type Parameters
- T extends object
Source object shape.
- K extends string | number | symbol = keyof T
Tracked properties from the source object.
Parameters
- options: PropChangeTracker.Options<T, K>
Returns PropChangeTracker<T, K>
- T extends object
Methods
check
-
Compares tracked properties with their previous values and commits the supplied values as the next baseline.
The returned PropChangeTracker.Data.ChangeSet is reused by subsequent checks.
Parameters
- value: T
Source object containing the tracked properties.
Returns ChangeSet<K>
- value: T
reset
-
Clears retained values and returns the tracker to its initial state.
Returns void
sync
-
Captures tracked property values as the new baseline without reporting changes.
Parameters
- value: T
Source object containing the tracked properties.
Returns void
- value: T
Explicitly checks selected properties against their previously supplied values.
PropertyChangeTrackerhas no subscriptions or reactive behavior of its own. A host, such as a Svelte reactive statement, determines when PropChangeTracker.check is called and retains full control over any resulting side effects.Each check compares and then commits the latest values. A comparator may therefore consider two distinct values equal, while the most recently supplied value still becomes the baseline for the next check.
PropChangeTracker maintains a snapshot of selected object properties and reports which tracked properties changed between successive check() calls. It is intended for explicit reactive control flow and does not introduce subscriptions or hidden reactivity.
Example
Track changes to a subset of resolved component properties.