Functions returning data to keep track of.
Add another callback to be checked.
Invalidate the subtree, forcing it to be redrawn.
Return whether any data has changed since the last check. If so, Mithril needs to re-diff the vnode and its children.
Generated using TypeDoc version 0.22.10
The
SubtreeRetainer
class keeps track of a number of pieces of data, comparing the values of these pieces at every iteration.This is useful for preventing redraws to relatively static (or huge) components whose VDOM only depends on very few values, when none of them have changed.
// Check two callbacks for changes on each update this.subtree = new SubtreeRetainer( () => this.attrs.post.freshness, () => this.showing );
// Add more callbacks to be checked for updates this.subtree.check(() => this.attrs.user.freshness);
// In a component's onbeforeupdate() method: return this.subtree.needsRebuild()
https://mithril.js.org/lifecycle-methods.html#onbeforeupdate