fun observe(eventHandler: (List<DittoDocument>, DittoLiveQueryEvent) -> Unit): DittoLiveQuery
Enables you to listen for changes that occur on a collection. The eventHandler closure will be
called when local or remote changes are made to documents that match the query generated by the chain
of operations that precedes the call to observe. The returned DittoLiveQuery object must be
kept in scope for as long as you want the provided eventHandler to be called when an update occurs.
eventHandler - a closure that will be called every time there is a transaction committed to the store that involves modifications to documents matching the query in the collection that observe was called on.
Return
a DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.
fun observe(callback: DittoLiveQueryCallback): DittoLiveQuery
Enables you to listen for changes that occur on a collection. The eventHandler closure will be
called when local or remote changes are made to documents that match the query generated by the chain
of operations that precedes the call to observe. The returned DittoLiveQuery object
must be kept in scope for as long as you want the provided eventHandler to be called when an update
occurs.
callback - an object that implements the DittoLiveQueryCallback interface, whose update function will be called every time there is a transaction committed to the store that involves modifications to documents matching the query in the collection that observe was called on.
Return
a DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.