ditto-lib / live.ditto / DittoPendingIDSpecificOperation / observeAndSubscribe

observeAndSubscribe

fun observeAndSubscribe(eventHandler: (DittoSingleDocumentLiveQueryEvent<T>) -> Unit): DittoSingleDocumentLiveQuery<T>
Deprecated: DeprecationLevel.ERROR

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 observeAndSubscribe. 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 observeAndSubscribe(callback: DittoSingleDocumentLiveQueryCallback<T>): DittoSingleDocumentLiveQuery<T>
Deprecated: DeprecationLevel.ERROR

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 observeAndSubscribe. 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.