Skip to content

Smarter firing of change events for cached/derived properties.

Latest
Compare
Choose a tag to compare
@HenrikJoreteg HenrikJoreteg released this 28 Dec 08:04
· 10 commits to master since this release

Derived properties is one of the most powerful features of HumanModel, being able to cache computed values and listen for changes to computed values is very useful for template bindings, etc.

Until this release, if you changed a model's property, it would automatically fire a change event for any derived property that had that property listed in its deps array. That's not ideal since the computed value may actually still be the same. So it's inefficient, because you may have change handlers manipulating the DOM for no reason.

This release makes it so that new derived values are compared against their cache and only fire the change if different.