fun observeLocal(eventHandler: (DittoDocument?, DittoSingleDocumentLiveQueryEvent) -> Unit): DittoLiveQuery
Enables you to listen for changes that occur in relation to a document. 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 observe
or also call
subscribe
separately after another findByID
call that references the same document ID. 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 a modification to the document with the relevant ID 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 observeLocal(callback: DittoSingleDocumentLiveQueryCallback): DittoLiveQuery
Enables you to listen for changes that occur in relation to a document. 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 observe
or also call
subscribe
separately after another findByID
call that references the same document ID. 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 DittoSingleDocumentLiveQueryCallback 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 observeLocal
was called on.
Return
a DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.