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 previously emitted by the input observable.
  • If you restart the resulting stream, it will remember and resubscribe to all of the streams it previously listened to.
  • If the input observable emits the same stream more than once, that stream will only be added once.
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 SwitchSignal[A](parent: Signal[Signal[A]]) extends WritableSignal[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 flattens an EventStream [ Signal[A] ] into an EventStream[A]

This flattens an EventStream [ Signal[A] ] into an EventStream[A]

When this stream is started, it re-emits the current value of the last signal emitted by parent (including any updates to it, until it switches to the next signal).

class SwitchStream[I, O](parent: Observable[I], makeStream: I => EventStream[O]) extends WritableStream[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.

Value parameters:
makeStream

Note: Must not throw