com.raquo.airstream.flatten

Type members

Classlikes

This is essentially a dynamic version of EventStream.merge.

This is essentially a dynamic version of EventStream.merge.

  • The resulting stream re-emits all the events emitted by all of the streams emitted by the input observable.
  • If you stop observing the resulting stream, it will forget all of the streams it previously listened to.
  • When you start it up again, it will start listening to the input observable from scratch, as if it's the first time you started it.
class ConcurrentFutureStream[A](val parent: Observable[Future[A]], dropPreviousValues: Boolean, emitIfFutureCompleted: Boolean) extends WritableEventStream[A] with SingleParentObservable[Future[A], A] with InternalNextErrorObserver[Future[A]]

This stream emits the values that the parent observables' emitted futures resolve with, in the order in which they resolve (which is likely different from the order in which the futures are emitted).

This stream emits the values that the parent observables' emitted futures resolve with, in the order in which they resolve (which is likely different from the order in which the futures are emitted).

Value parameters:
dropPreviousValues

if enabled, this option makes this stream NOT emit values of futures that were emitted earlier than a future that has already resolved. So if the parent stream emits three futures and the third one resolves before the first two, this stream will NOT emit the values of the first two futures when they resolve. This option is useful for applications such as autocomplete results

trait FlattenStrategy[-Outer <: (Observable), -Inner[_], Output <: (Observable)]

Observable.MetaObservable.flatten needs an instance of this trait to know how exactly to do the flattening.

Observable.MetaObservable.flatten needs an instance of this trait to know how exactly to do the flattening.

Companion:
object
Companion:
class
class SwitchEventStream[I, O](val parent: Observable[I], makeStream: I => EventStream[O]) extends WritableEventStream[O] with SingleParentObservable[I, O] with InternalNextErrorObserver[I]

parent observable emits values that we convert into streams using makeStream.

parent observable emits values that we convert into streams using makeStream.

This stream emits the events from the last such stream created this way.

Events are emitted at the same time as the currently tracked stream emits them (but in a new transaction).

When parent emits a nextValue, this stream switches to emitting events from makeStream(nextValue) (which is a stream).

If parent stream emits an error, this stream re-emits that error and unsubscribes from the last emitted stream

If the stream created with makeStream emits an error, this stream re-emits it in a new transaction.

If parent is a signal in a failed state when SwitchEventStream is created, parent's error is re-emitted in a new transaction, as if makeStream returned a stream that emitted this error.

Warning: Similar to com.raquo.airstream.eventbus.EventBus, this stream emits events in a new transaction because its proper topoRank would need to be dynamic, which we don't support.

Note: this stream loses its memory if stopped.

Value parameters:
makeStream

Note: Must not throw

class SwitchSignal[A](val parent: Signal[Signal[A]]) extends WritableSignal[A] with SingleParentObservable[Signal[A], A] with InternalTryObserver[Signal[A]]

This flattens a Signal[ Signal[A] ] into a Signal[A]

This flattens a Signal[ Signal[A] ] into a Signal[A]

When this signal is started, its current value tracks the current value of the last signal emitted by parent.

This signal follows standard signal mechanics:

  • It adds an internal observer to the signal that it's currently tracking while it's tracking it.
  • It does not update when it is stopped, even if the signal being tracked is not stopped (e.g. if it has other observers).
  • So if you want a consistent value out of this signal, keep it observed.