dittosynckit / live.ditto / DittoPendingIDSpecificOperation / observeWithNextSignal

observeWithNextSignal

fun observeWithNextSignal(eventHandler: (DittoDocument?, DittoSingleDocumentLiveQueryEvent, DittoSignalNext) -> Unit): DittoLiveQuery

Enables you to listen for changes that occur in relation to a document, and to signal when you are ready for the live query to deliver the next event. The eventHandler closure will be called when local or remote changes are made to the document referenced by the findByID call that precedes the call to observeWithNextSignal. 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 a modification to the document with the relevant ID 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 observeWithNextSignal(callback: DittoSingleDocumentLiveQueryWithNextSignalCallback): DittoLiveQuery

Enables you to listen for changes that occur in relation to a document, and to signal when you are ready for the live query to deliver the next event. The callback parameter will be called when local or remote changes are made to the document referenced by the findByID call that precedes the call to observeWithNextSignal. 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 DittoSingleDocumentLiveQueryWithNextSignalCallback interface, whose update function will be called every time there is a transaction committed to the store that involves a modification to the document with the relevant ID 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.