com.raquo.airstream.misc

Type members

Classlikes

class FilterEventStream[A](val parent: EventStream[A], passes: A => Boolean) extends WritableEventStream[A] with SingleParentObservable[A, A] with InternalNextErrorObserver[A]

This stream fires a subset of the events fired by its parent

This stream fires a subset of the events fired by its parent

This stream emits an error if the parent stream emits an error (Note: no filtering applied), or if passes throws

Value Params
passes

Note: guarded against exceptions

class FoldLeftSignal[A, B](val parent: Observable[A], makeInitialValue: () => Try[B], fn: (Try[B], Try[A]) => Try[B]) extends WritableSignal[B] with SingleParentObservable[A, B] with InternalTryObserver[A]

Note: In folds, failure is often toxic to all subsequent events. You often can not satisfactorily recover from a failure downstream because you will not have access to previous non-failed state in fn Therefore, make sure to handle recoverable errors in fn.

Note: In folds, failure is often toxic to all subsequent events. You often can not satisfactorily recover from a failure downstream because you will not have access to previous non-failed state in fn Therefore, make sure to handle recoverable errors in fn.

Value Params
fn

Note: Must not throw!

makeInitialValue

Note: Must not throw!

class MapEventStream[I, O](val parent: Observable[I], project: I => O, recover: Option[PartialFunction[Throwable, Option[O]]]) extends WritableEventStream[O] with SingleParentObservable[I, O] with InternalNextErrorObserver[I]

This stream applies a project function to events fired by its parent and fires the resulting value

This stream applies a project function to events fired by its parent and fires the resulting value

This stream emits an error if the parent observable emits an error or if project throws

If recover is defined and needs to be called, it can do the following:

  • Return Some(value) to make this stream emit value
  • Return None to make this stream ignore (swallow) this error
  • Not handle the error (meaning .isDefinedAt(error) must be false) to emit the original error

If recover throws an exception, it will be wrapped in ErrorHandlingError and propagated.

Value Params
project

Note: guarded against exceptions

recover

Note: guarded against exceptions

class MapSignal[I, O](val parent: Signal[I], val project: I => O, val recover: Option[PartialFunction[Throwable, Option[O]]]) extends WritableSignal[O] with SingleParentObservable[I, O] with InternalTryObserver[I]

This signal emits an error if the parent observable emits an error or if project throws

This signal emits an error if the parent observable emits an error or if project throws

If recover is defined and needs to be called, it can do the following:

  • Return Some(value) to make this signal emit value
  • Return None to make this signal ignore (swallow) this error
  • Not handle the error (meaning .isDefinedAt(error) must be false) to emit the original error
Value Params
project

Note: guarded against exceptions

recover

Note: guarded against exceptions