SourceVar

com.raquo.airstream.state.SourceVar
class SourceVar[A] extends Var[A]

The regular Var that's created with Var.apply.

See also DerivedVar, created with myVar.zoom(a => b)(b => a)(owner)

Attributes

Graph
Supertypes
trait Var[A]
trait Named
trait Sink[A]
trait SignalSource[A]
trait Source[A]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

protected def defaultDisplayName: String

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

Inherited from:
Named
final def displayName: String

Attributes

Inherited from:
Named
def invert()(implicit ev: A =:= Boolean): Unit

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
def invertWriter(implicit ev: A =:= Boolean): Observer[Unit]

Observer that writes !var.now(), for vars of booleans.

Observer that writes !var.now(), for vars of booleans.

Attributes

Inherited from:
Var
def now(): A

Attributes

Throws
Exception

if currentValue is a Failure

Inherited from:
Var
final def set(value: A): Unit

Attributes

Inherited from:
Var
def setDisplayName(name: String): Named.this.type

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
final def setError(error: Throwable): Unit

Attributes

Inherited from:
Var
def setTry(tryValue: Try[A]): Unit

Attributes

Inherited from:
Var
def someWriter[V](implicit evidence: Option[V] <:< A): Observer[V]

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
override def toObservable: Signal[A]

Attributes

Definition Classes
Inherited from:
Var
override def toObserver: Observer[A]

Attributes

Definition Classes
Var -> Sink
Inherited from:
Var
final override def toString: String

Override defaultDisplayName instead of this, if you need to.

Override defaultDisplayName instead of this, if you need to.

Attributes

Definition Classes
Named -> Any
Inherited from:
Named
def tryNow(): Try[A]

Attributes

Inherited from:
Var
def tryUpdate(mod: Try[A] => Try[A]): Unit

Value parameters

mod

Note: must not throw

Attributes

Inherited from:
Var
def tryUpdater[B](mod: (Try[A], B) => Try[A]): Observer[B]

Value parameters

mod

(currValue, nextInput) => nextValue Note: Must not throw!

Attributes

Inherited from:
Var
def update(mod: A => A): Unit

Do not use on failed Vars. Use tryUpdate on those.

Do not use on failed Vars. Use tryUpdate on those.

Value parameters

mod

Note: guarded against exceptions

Attributes

Inherited from:
Var
def updater[B](mod: (A, B) => A): Observer[B]

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
def zoom[B](in: A => B)(out: (A, B) => A)(implicit owner: Owner): Var[B]

Attributes

Inherited from:
Var

Concrete fields

override val signal: StrictSignal[A]

Inherited fields

val writer: Observer[A]

Attributes

Inherited from:
Var