com.raquo.airstream.misc

Members list

Type members

Classlikes

class CollectStream[A, B](val parent: EventStream[A], fn: A => Option[B]) extends SingleParentStream[A, B], InternalNextErrorObserver[A]

This stream applies fn to the parent stream's events, and emits x from the resulting Some(x) value (if None, nothing is fired).

This stream applies fn to the parent stream's events, and emits x from the resulting Some(x) value (if None, nothing is fired).

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

Value parameters

fn

Note: guarded against exceptions

Attributes

Supertypes
trait SingleParentStream[A, B]
trait InternalObserver[A]
trait WritableStream[B]
trait EventStream[B]
trait EventSource[B]
trait Observable[B]
trait Named
trait Source[B]
class Object
trait Matchable
class Any
Show all
class DropStream[A](val parent: EventStream[A], dropWhile: A => Boolean, reset: () => Unit, resetOnStop: Boolean) extends SingleParentStream[A, A], InternalNextErrorObserver[A]

Event stream that mimics the parent event stream, except that first it skips (drops) the parent's events, for as long as dropWhile returns true. As soon as it returns false for the first time, it starts mirroring the parent stream faithfully.

Event stream that mimics the parent event stream, except that first it skips (drops) the parent's events, for as long as dropWhile returns true. As soon as it returns false for the first time, it starts mirroring the parent stream faithfully.

Note: only events are dropped, not errors.

Value parameters

dropWhile

nextEvent => shouldDrop Function which determines whether this stream should drop the given event. Warning: MUST NOT THROW!

reset

This is called when this stream is stopped if resetOnStop is true. Use it to reset your dropWhile function's internal state, if needed. Warning: MUST NOT THROW!

resetOnStop

If true, stopping this stream will reset the stream's memory of previously dropped events (up to you to implement the reset as far as your dropWhile function is concerned though).

Attributes

Supertypes
trait SingleParentStream[A, A]
trait InternalObserver[A]
trait WritableStream[A]
trait EventStream[A]
trait EventSource[A]
trait Observable[A]
trait Named
trait Source[A]
class Object
trait Matchable
class Any
Show all
class FilterStream[A](val parent: EventStream[A], passes: A => Boolean) extends SingleParentStream[A, A], 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 parameters

passes

Note: guarded against exceptions

Attributes

Supertypes
trait SingleParentStream[A, A]
trait InternalObserver[A]
trait WritableStream[A]
trait EventStream[A]
trait EventSource[A]
trait Observable[A]
trait Named
trait Source[A]
class Object
trait Matchable
class Any
Show all
class MapSignal[I, O](val parent: Signal[I], val project: I => O, val recover: Option[PartialFunction[Throwable, Option[O]]]) extends SingleParentSignal[I, O]

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 parameters

project

Note: guarded against exceptions

recover

Note: guarded against exceptions

Attributes

Supertypes
trait SingleParentSignal[I, O]
trait InternalObserver[I]
trait WritableSignal[O]
trait Signal[O]
trait SignalSource[O]
trait Observable[O]
trait Named
trait Source[O]
class Object
trait Matchable
class Any
Show all
Known subtypes
class DerivedVarSignal[A, B]
class ObservedSignal[A]
class MapStream[I, O](val parent: Observable[I], project: I => O, recover: Option[PartialFunction[Throwable, Option[O]]]) extends SingleParentStream[I, O], 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 parameters

project

Note: guarded against exceptions

recover

Note: guarded against exceptions

Attributes

Supertypes
trait SingleParentStream[I, O]
trait InternalObserver[I]
trait WritableStream[O]
trait EventStream[O]
trait EventSource[O]
trait Observable[O]
trait Named
trait Source[O]
class Object
trait Matchable
class Any
Show all
class ScanLeftSignal[A, B](val parent: Observable[A], makeInitialValue: () => Try[B], fn: (Try[B], Try[A]) => Try[B]) extends SingleParentSignal[A, B]

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 parameters

fn

Note: Must not throw!

makeInitialValue

Note: Must not throw!

Attributes

Supertypes
trait SingleParentSignal[A, B]
trait InternalObserver[A]
trait WritableSignal[B]
trait Signal[B]
trait SignalSource[B]
trait Observable[B]
trait Named
trait Source[B]
class Object
trait Matchable
class Any
Show all
class SignalFromStream[A](val parent: EventStream[A], pullInitialValue: => Try[A], cacheInitialValue: Boolean) extends SingleParentSignal[A, A]

Attributes

Supertypes
trait SingleParentSignal[A, A]
trait InternalObserver[A]
trait WritableSignal[A]
trait Signal[A]
trait SignalSource[A]
trait Observable[A]
trait Named
trait Source[A]
class Object
trait Matchable
class Any
Show all
class StreamFromSignal[A](val parent: Signal[A], changesOnly: Boolean) extends SingleParentStream[A, A], InternalTryObserver[A]

Attributes

Supertypes
trait SingleParentStream[A, A]
trait InternalObserver[A]
trait WritableStream[A]
trait EventStream[A]
trait EventSource[A]
trait Observable[A]
trait Named
trait Source[A]
class Object
trait Matchable
class Any
Show all
class TakeStream[A](val parent: EventStream[A], takeWhile: A => Boolean, reset: () => Unit, resetOnStop: Boolean) extends SingleParentStream[A, A], InternalNextErrorObserver[A]

Event stream that mimics the parent event stream (both events and errors) for as long as takeWhile returns true. As soon as takeWhile returns false for the first time, it stops emitting anything.

Event stream that mimics the parent event stream (both events and errors) for as long as takeWhile returns true. As soon as takeWhile returns false for the first time, it stops emitting anything.

Value parameters

reset

This is called when this stream is stopped if resetOnStop is true. Use it to reset your takeWhile function's internal state, if needed. Warning: MUST NOT THROW!

resetOnStop

If true, stopping this stream will reset the stream's memory of previously taken events (up to you to implement the reset as far as your takeWhile function is concerned though).

takeWhile

nextEvent => shouldDrop Function which determines whether this stream should take the given event. Warning: MUST NOT THROW!

Attributes

Supertypes
trait SingleParentStream[A, A]
trait InternalObserver[A]
trait WritableStream[A]
trait EventStream[A]
trait EventSource[A]
trait Observable[A]
trait Named
trait Source[A]
class Object
trait Matchable
class Any
Show all