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.
Attributes
- Graph
-
- Supertypes
-
trait Var[B]trait Namedtrait Sink[B]trait SignalSource[B]trait Source[B]class Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete 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.
Attributes
- Definition Classes
Inherited methods
Attributes
- Inherited from:
- Named
Update a boolean Var by flipping its value (true -> false, or false -> true)
Update a boolean Var by flipping its value (true -> false, or false -> true)
Attributes
- Inherited from:
- Var
Observer that writes !var.now(), for vars of booleans.
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
Attributes
- 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()
Attributes
- Inherited from:
- Var
Attributes
- Definition Classes
- Inherited from:
- Var
Override defaultDisplayName instead of this, if you need to.
Override defaultDisplayName instead of this, if you need to.
Attributes
Value parameters
- mod
-
(currValue, nextInput) => nextValue Note: Must not throw!
Attributes
- Inherited from:
- Var
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
Attributes
- Inherited from:
- Var