observe

fun observe(eventHandler: (DittoCollectionsEvent) -> Unit): DittoLiveQuery

Enables you to listen for changes that occur in relation to the collections that are known about. A block gets called when an update is received either locally or remotely.

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.

Return

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

Parameters

eventHandler

a closure that will be called every time there is an update about the list of known about collections.


fun observe(callback: DittoCollectionsCallback): DittoLiveQuery

Enables you to listen for changes that occur in relation to the collections that are known about. A block gets called when an update is received either locally or remotely.

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.

Return

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

Parameters

callback

an object that implements the DittoLiveQueryCallback interface, whose update function will be called every time there is an update about the list of known about collections.