8.12
The annotation Obs.of(annot) is
satisfied by an annotation whose current value satisfies
annot. The annotation
MaybeObs.of(annot) is satisfied by a
value that satisfies either annot or
Obs.of(annot).
Returns a Racket object that corresponds to the observable for use
directly with
racket/gui/easy.
Returns the value via
Obs.peek (which you shouldn’t normally
do) or updates the value via
Obs.update (ignoring the current
value).
> o.value |
"apple" |
> o.value := "banana" |
> o.value |
"banana" |
Adds f as a function to be called when the value of
obs changes.
Removes f as a function to be called when the value of
obs changes.
Changes the value v of obs to
f(v). Returns the new value.
Returns the current value of obs.
Normally, instead of peeking an observable’s value, you should either
register an observer or pass an observer to a constructor that expects
one. For example, when an observer’s value should affect drawing in a
Canvas, then the first argument to
Canvas should the observer (or one derived from it),
and then a rendered canvas will be updated when the observable changes.
Returns an observer like obs, but named as name.
Returns an observer whose value changes each time that obs’s
value changes, where the new observer’s value is changed to
f(v) when obs is changed to
v.
Returns a new observable whose value changes to the value of
obs when there is at least a msec millisecond pause
in changes to obs.
Returns a new observable whose value changes to the value of
obs at most once per msec milliseconds.
Returns a new observable whose value changes to the value of
f(obs.value, ...) or
{key: obs.value, ...} when the value
of any
obs changes.