A model behaves like a Ref[Ex[A]]
, that is it can give an expression,
and it can be "set" to an expression, which means its internal state is synchronized to another expression.
For example, a slider widget may contain a Model[Int]
where the expression represents the current slider value,
and updating the expression synchronizes the slider to an external expression.
Syntactic alternatives are available through the implicit Ops
, so that one can write
model <-- ex
instead of model.update(ex)
or model <-> attr
instead of
model.update(attr); attr.update(model())
.
- Companion
- object