DerivedVar
DerivedVar has the same Var contract as SourceVar, but instead of maintaining its own state it is essentially a lens on the underlying SourceVar.
This Var is active for as long as its signal has listeners.
Being a StrictSignal, it already starts out with a subscription owned by owner
,
but even if owner kills its subscriptions, this Var's signal might have other listeners.
Value members
Inherited methods
This is the method that subclasses override to preserve the user's ability to set custom display names.
This is the method that subclasses override to preserve the user's ability to set custom display names.
- Inherited from:
- Named
Set the display name for this instance (observable or observer).
Set the display name for this instance (observable or observer).
- This method modifies the instance and returns
this
. It does not create a new instance. - New name you set will override the previous name, if any. This might change in the future. For the sake of sanity, don't call this more than once for the same instance.
- If display name is set, toString will output it instead of the standard type@hashcode string
- Inherited from:
- Named
Write values into a Var of Option[V] without manually wrapping in Some()
Write values into a Var of Option[V] without manually wrapping in Some()
- Inherited from:
- Var
Override defaultDisplayName instead of this, if you need to.
Override defaultDisplayName instead of this, if you need to.
An observer much like writer, but can compose input events with the current value of the var, for example:
An observer much like writer, but can compose input events with the current value of the var, for example:
val v = Var(List(1, 2, 3)) val appender = v.updater((acc, nextItem) => acc :+ nextItem) appender.onNext(4) // v now contains List(1, 2, 3, 4)
Do not use on failed Vars. Use tryUpdater on those.
- Value parameters:
- mod
(currValue, nextInput) => nextValue
- Inherited from:
- Var