Fold

reactives.operator.Fold
object Fold

Folds when any one of a list of events occurs, if multiple events occur, every fold is executed in order.

Example for a counter that can be reset:

 Fold(0)(
   add act { x => Fold.current + v },
   reset act { _ => 0 }
 )

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Fold.type

Members list

Type members

Classlikes

class Branch[S](val staticDependencies: List[of[State]], val isStatic: Boolean, val run: DynamicTicket[State] => FoldState[S] ?=> S)

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[T](init: => T)(branches: Branch[T]*)(using ticket: CreationTicket[State]): Signal[T]
inline def branch[T](inline expr: FoldState[T] ?=> T): Branch[T]

Fold branches allow to define more complex fold logic

Fold branches allow to define more complex fold logic

Attributes

inline def current[S](using fs: FoldState[S]): S