Observing Data Changes
A store observer is a DQL query that runs continuously and triggers a callback when a change to the store impacts the results of the query.
Store observers are useful when you want to monitor changes from your local Ditto store and react to them immediately. For instance, when your end user updates their profile, asynchronously display changes in realtime.
Using the registerObserver method, set up an observer within the store namespace enclosed with a query that specifies the collection to watch for changes, as well as your logic to handle the incoming changes.
o associate arguments with your query add them as a paramater.
To cancel a store observer, call cancel on the observer object.
Once canceled, the store observer will stop processing in the background and will no longer call the provided callback.
To access store observers from the local Ditto store: