trait Circuit[M <: AnyRef] extends Dispatcher
- Alphabetic
- By Inheritance
- Circuit
- Dispatcher
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type HandlerFunction = (M, Any) => Option[ActionResult[M]]
Abstract Value Members
- abstract def actionHandler: HandlerFunction
Handles all dispatched actions
Handles all dispatched actions
- Attributes
- protected
- abstract def initialModel: M
Provides the initial value for the model
Provides the initial value for the model
- Attributes
- protected
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addProcessor(processor: ActionProcessor[M]): Unit
Adds a new
ActionProcessor[M]
to the action processing chain.Adds a new
ActionProcessor[M]
to the action processing chain. The processor is called for every dispatched action. - def apply[A](action: A)(implicit arg0: ActionType[A]): Unit
- Definition Classes
- Dispatcher
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def composeHandlers(handlers: HandlerFunction*): HandlerFunction
Composes multiple handlers into a single handler.
Composes multiple handlers into a single handler. Processing stops as soon as a handler is able to handle the action. If none of them handle the action,
None
is returned - def dispatch[A](action: A)(implicit arg0: ActionType[A]): Unit
Dispatch the action, call change listeners when completed
Dispatch the action, call change listeners when completed
- action
Action to dispatch
- Definition Classes
- Circuit → Dispatcher
- def dispatchBase[A](action: A): Boolean
Perform actual dispatching, without calling change listeners
Perform actual dispatching, without calling change listeners
- Attributes
- protected
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def foldHandlers(handlers: HandlerFunction*): HandlerFunction
Folds multiple handlers into a single function so that each handler is called in turn and an updated model is passed on to the next handler.
Folds multiple handlers into a single function so that each handler is called in turn and an updated model is passed on to the next handler. Returned
ActionResult
contains the final model and combined effects. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def handleEffectProcessingError[A](action: A, error: Throwable): Unit
- action
the action that caused the effects
- error
the Exception that was encountered while processing the effects
- def handleError(msg: String): Unit
Handle a non-fatal error, such as dispatching an action with no action handler.
Handle a non-fatal error, such as dispatching an action with no action handler.
- msg
Error message
- def handleFatal(action: Any, e: Throwable): Unit
Handle a fatal error.
Handle a fatal error. Override this function to do something with exceptions that occur while dispatching actions.
- action
Action that caused the exception
- e
Exception that was thrown
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def removeProcessor(processor: ActionProcessor[M]): Unit
Removes a previously added
ActionProcessor[M]
from the action processing chain. - def subscribe[T](cursor: ModelR[M, T])(listener: (ModelRO[T]) => Unit): () => Unit
Subscribes to listen to changes in the model.
Subscribes to listen to changes in the model. By providing a
cursor
you can limit what part of the model must change for your listener to be called. If omitted, all changes result in a call.- cursor
Model reader returning the part of the model you are interested in.
- listener
Function to be called when model is updated. The listener function gets the model reader as a parameter.
- returns
A function to unsubscribe your listener
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def zoom[T](get: (M) => T)(implicit feq: FastEq[_ >: T]): ModelR[M, T]
Zoom into the model using the
get
functionZoom into the model using the
get
function- get
Function that returns the part of the model you are interested in
- returns
A
ModelR[T]
giving you read-only access to part of the model
- def zoomFlatMap[F[_], A, B](fa: (M) => F[A])(f: (A) => F[B])(implicit monad: Monad[F], feq: FastEq[_ >: B]): ModelR[M, F[B]]
- def zoomFlatMapRW[F[_], A, B](fa: (M) => F[A])(f: (A) => F[B])(set: (M, F[B]) => M)(implicit monad: Monad[F], feq: FastEq[_ >: B]): ModelRW[M, F[B]]
- def zoomMap[F[_], A, B](fa: (M) => F[A])(f: (A) => B)(implicit monad: Monad[F], feq: FastEq[_ >: B]): ModelR[M, F[B]]
- def zoomMapRW[F[_], A, B](fa: (M) => F[A])(f: (A) => B)(set: (M, F[B]) => M)(implicit monad: Monad[F], feq: FastEq[_ >: B]): ModelRW[M, F[B]]
- def zoomRW[T](get: (M) => T)(set: (M, T) => M)(implicit feq: FastEq[_ >: T]): ModelRW[M, T]
Zoom into the model using
get
andset
functionsZoom into the model using
get
andset
functions- get
Function that returns the part of the model you are interested in
- set
Function that updates the part of the model you are interested in
- returns
A
ModelRW[T]
giving you read/update access to part of the model
- macro def zoomTo[T](field: (M) => T): ModelRW[M, T]
Deprecated Value Members
- def combineHandlers(handlers: HandlerFunction*): HandlerFunction
- Annotations
- @deprecated
- Deprecated
(Since version 0.5.1) Use composeHandlers or foldHandlers instead