ditto / live.ditto / DittoPendingCursorOperation / observeLocalWithNextSignal

observeLocalWithNextSignal

fun observeLocalWithNextSignal(eventHandler: (List<DittoDocument>, DittoLiveQueryEvent, DittoSignalNext) -> Unit): DittoLiveQuery

Enables you to listen for changes that occur on a collection, and to signal when you are ready for the live query to deliver the next event. This won't subscribe to receive changes made remotely by others and so it will only fire updates when a local change is made. If you want to receive remotely performed updates as well then use observeWithNextSignal or call subscribe with the relevant query. 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.

Parameters

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 observeLocal was called on.

Return
a DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

fun observeLocalWithNextSignal(callback: DittoLiveQueryWithNextSignalCallback): DittoLiveQuery

Enables you to listen for changes that occur on a collection, and to signal when you are ready for the live query to deliver the next event. This won't subscribe to receive changes made remotely by others and so it will only fire updates when a local change is made. If you want to receive remotely performed updates as well then use observeWithNextSignal or call subscribe with the relevant query. 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.

Parameters

callback - an object that implements the DittoLiveQueryWithNextSignalCallback 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 observeLocal was called on.

Return
a DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.