ditto-lib / live.ditto / DittoPendingIDSpecificOperation / observe

observe

fun observe(eventHandler: (DittoSingleDocumentLiveQueryEvent<T>) -> Unit): DittoSingleDocumentLiveQuery<T>

Enables you to listen for changes that occur in relation to a document. 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 observe. The returned DittoSingleDocumentLiveQuery object must be kept in scope for as long as you want the provided eventHandler to be called when an update occurs.

fun observe(callback: DittoSingleDocumentLiveQueryCallback<T>): DittoSingleDocumentLiveQuery<T>

Enables you to listen for changes that occur in relation to a document. 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 observe. The returned DittoSingleDocumentLiveQuery object must be kept in scope for as long as you want the provided eventHandler to be called when an update occurs.