setValue
Sets the value of the observable property.
This function attempts to update the state
with the new value
.
If the new
value
is the same as the currentstate
, no action is taken, but theonBindCallback
is still invoked.If the
value
is different:It first calls all registered
beforeChange
listeners. If any of these listeners returnfalse
, the update is aborted, and the function returns.If all
beforeChange
listeners allow the change (or if there are no such listeners), thestate
is updated to the newvalue
.After the
state
is updated, all registeredafterChange
listeners are invoked with the old and new values.The
onUpdated
callback (if provided during construction) is invoked with the newvalue
.Regardless of whether the value changed or not, the
onBindCallback
(if set viabind
) is invoked with the new (or current)value
.
Parameters
The new value to set for the property.