Class/Object

japgolly.scalajs.react

CallbackOption

Related Docs: object CallbackOption | package react

Permalink

final class CallbackOption[A] extends AnyVal

Callback that can short-circuit along the way when conditions you specify, aren't met.

Especially useful for event handlers such as key handlers, drag-and-drop handlers, etc, where you check a condition, perform an effect, check another condition, perform another effect, etc.

This is meant to be lightweight, and be immediately useful without the typical pain of imports, implicit conversions and extension methods then normally accompany monad transforms in Scala.

For a more generic (i.e. beyond Option) or comprehensive monad transformer use Scalaz or similar.

Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CallbackOption
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CallbackOption(cbfn: () ⇒ Option[A])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. def &&[B](b: CallbackOption[B]): CallbackOption[Unit]

    Permalink
  4. def *>[B](next: CallbackOption[B]): CallbackOption[B]

    Permalink

    Alias for >>.

    Alias for >>.

    Where >> is often associated with Monads, *> is often associated with Applicatives.

    Annotations
    @inline()
  5. def <*[B](next: CallbackOption[B]): CallbackOption[A]

    Permalink

    Sequence actions, discarding the value of the second argument.

  6. def <<[B](prev: CallbackOption[B]): CallbackOption[A]

    Permalink

    Sequence a callback to run before this, discarding any value produced by it.

  7. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  8. def >>[B](next: CallbackOption[B]): CallbackOption[B]

    Permalink

    Sequence a callback to run after this, discarding any value produced by this.

  9. def >>=[B](f: (A) ⇒ CallbackOption[B]): CallbackOption[B]

    Permalink

    Alias for flatMap.

    Alias for flatMap.

    Annotations
    @inline()
  10. def asCallback: CallbackTo[Option[A]]

    Permalink
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def filter(condition: (A) ⇒ Boolean): CallbackOption[A]

    Permalink
  13. def filterNot(condition: (A) ⇒ Boolean): CallbackOption[A]

    Permalink
  14. def flatMap[B](f: (A) ⇒ CallbackOption[B]): CallbackOption[B]

    Permalink
  15. def flatMapOption[B](f: (A) ⇒ Option[B]): CallbackOption[B]

    Permalink
  16. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  17. def getOrElse[AA >: A](default: ⇒ AA): CallbackTo[AA]

    Permalink
  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. def map[B](f: (A) ⇒ B)(implicit ev: MapGuard[B]): CallbackOption[Out]

    Permalink
  20. def orElse[AA >: A](tryNext: CallbackOption[AA]): CallbackOption[AA]

    Permalink
  21. def toCallback(implicit ev: <:<[A, Unit]): Callback

    Permalink
  22. def toString(): String

    Permalink
    Definition Classes
    Any
  23. def unary_!(implicit ev: <:<[A, Unit]): CallbackOption[Unit]

    Permalink
  24. def unless(cond: ⇒ Boolean): CallbackOption[A]

    Permalink

    Conditional execution of this callback.

    Conditional execution of this callback. Reverse of when().

    cond

    The condition required to be false for this callback to execute.

    returns

    Some result of the callback executed, else None.

  25. def void: CallbackOption[Unit]

    Permalink

    Discard the value produced by this callback.

  26. def voidExplicit[B](implicit ev: <:<[A, B]): CallbackOption[Unit]

    Permalink

    Discard the value produced by this callback.

    Discard the value produced by this callback.

    This method allows you to be explicit about the type you're discarding (which may change in future).

    Annotations
    @inline()
  27. def when(cond: ⇒ Boolean): CallbackOption[A]

    Permalink

    Conditional execution of this callback.

    Conditional execution of this callback.

    cond

    The condition required to be true for this callback to execute.

  28. def widen[B >: A]: CallbackOption[B]

    Permalink
  29. def withFilter(condition: (A) ⇒ Boolean): CallbackOption[A]

    Permalink
  30. def zip[B](cb: CallbackOption[B]): CallbackOption[(A, B)]

    Permalink
  31. def |[AA >: A](tryNext: CallbackOption[AA]): CallbackOption[AA]

    Permalink

    Alias for orElse.

    Alias for orElse.

    Annotations
    @inline()
  32. def |>[B](f: (A) ⇒ B)(implicit ev: MapGuard[B]): CallbackOption[Out]

    Permalink

    Alias for map.

    Alias for map.

    Annotations
    @inline()
  33. def ||[B](b: CallbackOption[B]): CallbackOption[Unit]

    Permalink

Deprecated Value Members

  1. def get: CallbackTo[Option[A]]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.1) Use .toCallback instead of .get.void, or .asCallback instead of .get

  2. def toBoolCB: CallbackTo[Boolean]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.1) Use .asCallback.map(_.isDefined)

Inherited from AnyVal

Inherited from Any

Ungrouped