com.raquo.airstream.timing

Type members

Classlikes

class DebounceEventStream[A](val parent: EventStream[A], intervalMs: Int) extends WritableEventStream[A] with SingleParentObservable[A, A] with InternalTryObserver[A]

This stream emits the last event emitted by parent, but only after intervalMs has elapsed since parent emitted the previous event.

This stream emits the last event emitted by parent, but only after intervalMs has elapsed since parent emitted the previous event.

Essentially, this stream emits the parent's last event, but only once the parent stops emitting events for intervalMs.

See also ThrottleEventStream

class DelayEventStream[A](val parent: EventStream[A], delayMs: Int) extends WritableEventStream[A] with SingleParentObservable[A, A] with InternalNextErrorObserver[A]
class FutureEventStream[A](future: Future[A], emitIfFutureCompleted: Boolean) extends WritableEventStream[A]

This stream emits a value that the future resolves with.

This stream emits a value that the future resolves with.

This stream will not emit any events to subscribers added after the future was resolved, except as provided by emitIfFutureCompleted.

Value Params
emitIfFutureCompleted

If false, this stream will emit an event when it's initialized with an already completed future. Generally you should avoid this and use FutureSignal instead.

future

Note: guarded against failures

class FutureSignal[A](future: Future[A]) extends WritableSignal[Option[A]] with StrictSignal[Option[A]]

This signal behaves a bit differently than other signals typically do: it keeps track of state regardless of whether it is started. This is possible because this case requires no special memory management.

This signal behaves a bit differently than other signals typically do: it keeps track of state regardless of whether it is started. This is possible because this case requires no special memory management.

Note that being a StrictSignal, this exposes now and tryNow methods, however if the future was not yet completed when this signal was created, this signal's current value will be updated asynchronously after the future has completed.

class PeriodicEventStream[A](initial: A, next: A => Option[(A, Int)], emitInitial: Boolean, resetOnStop: Boolean) extends WritableEventStream[A]
Value Params
next

(currentState => (nextState, nextIntervalMs) Note: guarded against exceptions. If next throws, stream will emit that error

class SyncDelayEventStream[A](val parent: EventStream[A], after: EventStream[_]) extends WritableEventStream[A] with SingleParentObservable[A, A] with InternalTryObserver[A] with SyncObservable[A]
class ThrottleEventStream[A](val parent: EventStream[A], intervalMs: Int, leading: Boolean) extends WritableEventStream[A] with SingleParentObservable[A, A] with InternalTryObserver[A]

ThrottleEventStream emits at most one event per intervalMs.

ThrottleEventStream emits at most one event per intervalMs.

  • All events are emitted in a new transaction, after an async delay, even if the delay is zero ms
  • Any incoming event is scheduled to be emitted as soon as possible, but no sooner than intervalMs after the last event that was actually emitted by the throttled stream
  • When an event is scheduled to be emitted, any event that was previously scheduled is cancelled (that's the nature of throttling, you only get at most one event within intervalMs)
  • Errors are propagated in the same manner
  • Stopping the stream cancels scheduled events and makes it forget everything that happened before.

See also See also DebounceEventStream