Hi, is there a way to get the value before and after the transaction?
For example if I have a Y.Map { ‘my-key’ : ‘my_val’ } and after transaction it becomes
{ ‘my-key’ : ‘new_val’ }, how can I know what previous value was there (in the example it’s my_val) given then I am hooked to on(‘update’ … ) event
There are beforeTransaction
and afterTransaction
events on the Doc:
Also the observe
event on the Y.Map contains the old value in ymapEvent.changes.keys.get(key).oldValue
:
I’m trying to do the same thing, but for a yText shared type. I see in the yText documentation examples a reference to oldValue
but that doesn’t actually seem to be accessible in practice.
Is there a way to get the text that is being deleted from a transaction/event? The transaction has already been applied by the time the observer is called, so I can’t even look up the text at the position in the ytext.
Thanks!