ditto-lib / live.ditto / DittoSingleDocumentLiveQueryEvent / <init>

<init>

DittoSingleDocumentLiveQueryEvent(isInitial: Boolean, oldDocument: DittoDocument<T>?, newDocument: DittoDocument<T>?)

Represents a change to a document by providing a value representing the document's old state and a value representing the document's new state. If it is the first time that one of these events is delivered for a DittoSingleDocumentLiveQuery then the isInitial value will be true and the newDocument value will be populated, if there existed a document with the relevant ID. If there is no matching document found then both oldDocument and newDocument will be nil. If the document exists and is removed at a later date then an event will be delivered where oldDocument will be the most recent version of the document and newDocument will be nil. Similarly, if there was no document with the relevant ID and a document with the ID is later added then an event will be delivered where oldDocument is nil and newDocument will be the document as it was just inserted.