Closed AnnaFrom19 closed 3 months ago
The value
is the lastValue
from the getter. The missing is only the third argument, which was removed for several reasons:
observe
method, so you can watch and do action based on the change of the valuevalue()
method, as you can have different scenarios when that function is called - after the assertion, after the dependency update, etc.. in those situations the lastValue
would behave differently, so to avoid confusion, it was removedYour example is a very good case for the above reasons. Your param
is a strange value, as it only allows you to increase the value, and silently skip if the new value is lower. What should be a callback in the first place, you put into the property calculation (it was just fine before v9):
I am not sure what is the structure, and how the value is passed to your component, but instead of applying this logic inside of the property definition, it should be applied outside of it.
define({
tag: 'my-component',
input: {
value: 0,
observe(host, value) {
if (value > host.param) host.param = value;
},
},
param: 9,
});
Thanks for the answer. Then I will change my application logic. I think it will be even clearer in the new version.
Hi! Excuse me, can you explain why do you remove lastValue for setter and getter? In 8.* version we have smth like this:
But now only:
Is there any way to get current value of param?