1.5.0
版本发布时间: 2024-03-15 00:50:54
vanjs-org/van最新发布版本:1.5.2(2024-08-20 05:09:27)
1. Optimization on state derivations
Major optimization on how state derivations are being executed. For instance, with the code:
const a = van.state(3), b = van.state(5)
const s = van.derive(() => a.val + b.val)
If we have:
++a.val
++b.val
s
will be derived only once.
And if we have:
++a.val
--a.val
The derivation of s
will be skipped since a
remains unchanged after ++a.val
and --a.val
.
2. rawVal
property for State
objects
rawVal
property for State
objects for getting the current value of the State
object (peeking) without registering the state as a dependency of the binding function. For instance, the derived state: van.derive(() => a.rawVal + b.val)
will be updated when b
changes, but won't be updated when a
changes.