DittoPendingIDSpecificOperation
These objects are returned when using findByID
functionality on DittoCollection
s.
You can either call exec
on the object to get an immediate return value, or you can establish
either a live query or a subscription, which both work over time.
A live query, established by calling observeLocal
, will notify you every time there’s an
update to the document with the ID you provided in the preceding findByID
call.
A subscription, established by calling subscribe
, will act as a signal to other peers that you
would like to receive updates from them about the document with the ID you provided in the
preceding findByID
call.
Typically, an app would set up a subscribe
in some part of the application which is long-lived
to ensure the device receives updates from the mesh. These updates will be automatically
received and written into the local store. Elsewhere, where you need to use this data, an
observeLocal
can be used to notify you of the data, and all subsequent changes to the data.
Update and remove functionality is also exposed through this object.
-
Enables you to subscribe to changes that occur in relation to a document. Having a subscription acts as a signal to other peers that you are interested in receiving updates when local or remote changes are made to the relevant document. The returned
DittoSubscription
object must be kept in scope for as long as you want to keep receiving updates. -
Remove the document with the matching ID.
-
Evict the document with the matching ID.
-
Execute the find operation to return the document with the matching ID.
-
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 also call
subscribe
separately after anotherfindByID
call that references the same document ID. The returnedDittoLiveQuery
object must be kept in scope for as long as you want the providedeventHandler
to be called when an update occurs. -
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. 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 also call
subscribe
separately after anotherfindByID
call that references the same document ID. The returnedDittoLiveQuery
object must be kept in scope for as long as you want the providedeventHandler
to be called when an update occurs.
-
Update the document with the matching ID.