Writes

com.alecdorrington.laminarcomponents.Writes
final class Writes

The writes this client makes to one part of the server's state, kept so that a read of that part never undoes an edit made here:

  • A read is used only if no write began while it was on its way, nor was on its way when it began. Otherwise it is read again once the writes are done (settled).
  • A value read replaces the one on screen only where that is what the server was last known to hold; otherwise it is an edit not yet sent.

Values are recorded against the thing they belong to, usually the Var holding them, compared by identity.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def adopt[X](field: Var[X], value: X): Unit

Sets a Var to a value read from the server, unless edited here.

Sets a Var to a value read from the server, unless edited here.

Type parameters

X

The value.

Value parameters

field

The variable, which the value is recorded against.

value

The value read.

Attributes

def answered(thing: AnyRef, value: Any): Boolean

Whether the server has had its say on a value: no write of it is on its way, and it is the value last held or the last written, taken or not.

Whether the server has had its say on a value: no write of it is on its way, and it is the value last held or the last written, taken or not.

Value parameters

thing

What the value belongs to.

value

The value.

Attributes

Returns

Whether the server has had its say on the value.

def fresh(stamp: Int): Boolean

Whether a read that began at a stamp may be used.

Whether a read that began at a stamp may be used.

Value parameters

stamp

The mark taken as the read began.

Attributes

Returns

Whether the read may be used.

def hold(thing: AnyRef, value: Any): Unit

Records a value as the one the server holds, as when it is read or made.

Records a value as the one the server holds, as when it is read or made.

Value parameters

thing

What the value belongs to.

value

The value.

Attributes

def holds(thing: AnyRef, value: Any): Boolean

Whether the server holds a value, or will once the writes on their way land, so that writing it again is needless.

Whether the server holds a value, or will once the writes on their way land, so that writing it again is needless.

Value parameters

thing

What the value belongs to.

value

The value.

Attributes

Returns

Whether writing the value again is needless.

def idle: Boolean

Whether no write is on its way.

Whether no write is on its way.

Attributes

def stamp: Int

The mark to take as a read begins, to hand to fresh once it answers.

The mark to take as a read begins, to hand to fresh once it answers.

Attributes

def unedited(thing: AnyRef, value: Any): Boolean

Whether a value is what the server was last known to hold, with no write of it on its way. A thing never recorded counts as unedited.

Whether a value is what the server was last known to hold, with no write of it on its way. A thing never recorded counts as unedited.

Value parameters

thing

What the value belongs to.

value

The value.

Attributes

Returns

Whether the value is unedited here.

def write(thing: AnyRef, value: Any)(request: EventStream[Boolean]): EventStream[Boolean]

Counts a write of a value, recording it as held if the server takes it.

Counts a write of a value, recording it as held if the server takes it.

The write counts from the moment this is called until request answers, so subscribe at once (Requests.fire), and make request emit exactly once, failures included. A write that never answers freezes every later read of this part for good.

Value parameters

request

The write, emitting once whether the server took it.

thing

What the value belongs to.

value

The value written.

Attributes

Returns

The write, counted.

def writing[X](request: EventStream[X]): EventStream[X]

Counts a write of something with no recorded value, under the same rules as write.

Counts a write of something with no recorded value, under the same rules as write.

Type parameters

X

The write's answer.

Value parameters

request

The write, emitting exactly once when answered, however it went.

Attributes

Returns

The write, counted.

Concrete fields

val settled: EventStream[Unit]

Emits whenever the last write on its way has been answered.

Emits whenever the last write on its way has been answered.

Attributes