Interesting, first, which version are you looking to resolve this in?
So let me rephrase to see if I got it right:
You have a Property whose Value gets altered as part of the Document Save action.
When that happens, you want to know if the Property Value changed(Document got saved?)? so you can react to it?
From v.14+ you cannot listen to an Event, like ‘Document Saved’, so your option is to react when you get a new value. But a value change could happen in other scenarios. So maybe that does not fit your case?
If I’m right so far, I guess I need some background story to understand why you want to do something at that point
In the case of you wanting to have this code on your Property Editor UI Element, then that is the long journey, you could turn your value-property into a getter/setter method and call something in the case of you getting a new value.
in this style (Taken from a Core Property Editor):
@property()
public set value(newValue: string | undefined) {
this._value = newValue || '';
this.#updateSelectedState();
}
public get value(): string {
return this._value;
}
@skttl Yes, surely. But it does not really matter.
It comes down to complexity and a bit of performance.
Cause a getter/setter is just turning the property into a method, and it does not establish any extra computation to run.
Compared to consuming the context and then observing a state is more work on the computer, not something you should be worried about, cause the Backoffice does it a thousands times across various things. But its not needed in this case, so I would surely avoid it.
And then on the complexity scale, consuming and observing is way more complex code, which in theory make your code harder to maintain and more vulnerable. But for this case i’m generally begin theoretically.