Packages

class EventProcessor[Ev <: Event, V] extends AnyRef

This class represents a sequence of transformations that are applied to events feeding into an EventListener EventProcessor-s are immutable, so can be reused by multiple setters.

Example syntax: input(onChange().preventDefault.mapTo(true) --> myBooleanWriteBus)

Note: Params are protected to avoid confusing autocomplete options (e.g. "useCapture")

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EventProcessor
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new EventProcessor(eventProp: ReactiveEventProp[Ev], shouldUseCapture: Boolean = false, processor: (Ev) => Option[V])

    shouldUseCapture

    (false means using bubble mode) See useCapture docs here: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

    processor

    Processes incoming events before they're passed to the next processor or to the listening EventBus. Returns an Option of the processed value. If None, the value should not passed down the chain.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def -->[El <: Base](onNext: (V) => Unit): EventListener[Ev, V]
    Annotations
    @inline()
  4. def -->(sink: Sink[V]): EventListener[Ev, V]
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  8. def collect[V2](pf: PartialFunction[V, V2]): EventProcessor[Ev, V2]
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. val eventProp: ReactiveEventProp[Ev]
    Attributes
    protected
  12. def filter(passes: (V) => Boolean): EventProcessor[Ev, V]

    Values that do not pass will not propagate down the chain and into the emitter.

  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def map[V2](project: (V) => V2): EventProcessor[Ev, V2]
  17. def mapRaw[V2](project: (Ev, Option[V]) => Option[V2]): EventProcessor[Ev, V2]

    (originalEvent, accumulatedValue) => newAccumulatedValue

    (originalEvent, accumulatedValue) => newAccumulatedValue

    Unlike other processors, this one will fire regardless of .filter-s up the chain. Instead, if the event was filtered, project will receive None as accumulatedValue. The output of project should be Some(newValue), or None if you want to filter out this event.

  18. def mapTo[V2](value: => V2): EventProcessor[Ev, V2]

    Same as map(_ => value)

    Same as map(_ => value)

    Note: value will be re-evaluated every time the event is fired

  19. def mapToChecked: EventProcessor[Ev, Boolean]

    Get the value of event.target.checked

  20. def mapToEvent: EventProcessor[Ev, Ev]

    Get the original event.

    Get the original event. You might want to call this in a chain, after some other processing.

  21. def mapToStrict[V2](value: V2): EventProcessor[Ev, V2]

    Like mapTo, but with strict evaluation of the value

  22. def mapToValue: EventProcessor[Ev, String]

    Get the value of event.target.value

  23. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  26. def orElseEval(f: (Ev) => Unit): EventProcessor[Ev, V]

    Evaluate f if the value was filtered out up the chain.

    Evaluate f if the value was filtered out up the chain. For example:

    onClick.filter(isRightClick).orElseEval(_.preventDefault()) --> observer

    This observer will fire only on right clicks, and for events that aren't right clicks, ev.preventDefault() will be called instead.

  27. def preventDefault: EventProcessor[Ev, V]

    Prevent default browser action for the given event (e.g.

    Prevent default browser action for the given event (e.g. following the link when it is clicked) https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault

    Note: this is just a standard processor, so it will be fired in whatever order you have applied it. So for example, you can filter events before applying this, preventing default action only for certain events.

    Example: input(onKeyUp().filter(ev => ev.keyCode == KeyCode.Tab).preventDefault --> tabKeyUpBus)

  28. val processor: (Ev) => Option[V]
    Attributes
    protected
  29. def setAsChecked(implicit boolEvidence: <:<[V, Boolean]): EventProcessor[Ev, V]

    Write the resulting boolean into event.target.checked.

    Write the resulting boolean into event.target.checked. You can only do this on checkbox or radio button elements.

    Warning: if using this, do not use preventDefault. The browser may override the value you set here.

  30. def setAsValue(implicit stringEvidence: <:<[V, String]): EventProcessor[Ev, V]

    Write the resulting string into event.target.value.

    Write the resulting string into event.target.value. You can only do this on elements that have a value property - input, textarea, select

  31. val shouldUseCapture: Boolean
    Attributes
    protected
  32. def stopImmediatePropagation: EventProcessor[Ev, V]

    This method prevents other listeners of the same event from being called.

    This method prevents other listeners of the same event from being called. If several listeners are attached to the same element for the same event type, they are called in the order in which they were added. If stopImmediatePropagation() is invoked during one such call, no remaining listeners will be called.

    MDN https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation

    Note: this is just a standard processor, so it will be fired in whatever order you have applied it. So for example, you can filter events before applying this, propagation will be stopped only for certain events.

    Example: div(onClick.filter(isGoodClick).stopImmediatePropagation --> goodClickBus)

  33. def stopPropagation: EventProcessor[Ev, V]

    Propagation here refers to DOM Event bubbling or capture propagation.

    Propagation here refers to DOM Event bubbling or capture propagation. https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation

    Note: this is just a standard processor, so it will be fired in whatever order you have applied it. So for example, you can filter events before applying this, propagation will be stopped only for certain events.

    Example: div(onClick.filter(isGoodClick).stopPropagation --> goodClickBus)

  34. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  35. def toString(): String
    Definition Classes
    AnyRef → Any
  36. def useBubbleMode: EventProcessor[Ev, V]

    Use standard bubble propagation mode.

    Use standard bubble propagation mode. You don't need to call this unless you set useCapture previously.

    See useCapture docs here: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

  37. def useCapture: EventProcessor[Ev, V]

    Use capture mode (v=true) or bubble mode (v=false)

    Use capture mode (v=true) or bubble mode (v=false)

    Note that unlike preventDefault config which applies to individual events, useCapture is used to install the listener onto the DOM node in the first place.

    See useCapture docs here: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

  38. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  39. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  40. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped