RemoteEditBuffer

class RemoteEditBuffer<T : Any>(initial: T, generation: Long = 1)(source)

Owner-thread optimistic editing state independent of any particular text or form control. Older acknowledgements cannot overwrite a newer local edit; a newer authoritative generation resets pending edits.

Constructors

Link copied to clipboard
constructor(initial: T, generation: Long = 1)

Properties

Link copied to clipboard
Link copied to clipboard
var value: T

Functions

Link copied to clipboard
fun edit(value: T, sequence: Long)

Records a local edit after its action sequence has been allocated.

Link copied to clipboard
fun reconcile(value: T, generation: Long, acknowledgedSequence: Long): Boolean

Applies an authoritative value only when no newer local edit would be lost. Returns whether the visible value changed; callers preserve selection and IME on a false result.