I have an object with multiple observables. Is there a way in a computed to know which observable changes, therefore which observable fired the computed?
Thank you in advance Matthew
I have an object with multiple observables. Is there a way in a computed to know which observable changes, therefore which observable fired the computed?
Thank you in advance Matthew
Without details of exactly what you are trying to achieve, I'll post this in the hope it might help.
A simple way to track changes is to use the
.subscribe
method on an observable you want to track. Each time the observable gets updated, this method will fire.The
item
passed in to the subscribe function is optional, so you can use the new value if required.Here's a simple example of it in use with a computed:
Sample JSFiddle
JS:
HTML: