com.raquo.airstream.timing

Type members

Classlikes

class DebounceStream[A](val parent: EventStream[A], intervalMs: Int) extends SingleParentStream[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.

When stopped, this stream "forgets" about any pending events.

See also ThrottleStream

class DelayStream[A](val parent: EventStream[A], delayMs: Int) extends SingleParentStream[A, A] with InternalNextErrorObserver[A]
class JsPromiseSignal[A](promise: Promise[A]) extends WritableSignal[Option[A]]
class JsPromiseStream[A](promise: Promise[A], emitOnce: Boolean) extends WritableStream[A]

This stream emits a value that the promise resolves with, even if the promise was already resolved.

This stream emits a value that the promise resolves with, even if the promise was already resolved.

This stream emits only once. If you want to remember the value, Use JsPromiseSignal instead.

Value parameters:
promise

Note: guarded against failures

class PeriodicStream[A](initial: A, next: A => Option[(A, Int)], resetOnStop: Boolean) extends WritableStream[A]
Value parameters:
next

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

class SyncDelayStream[A](val parent: Observable[A], after: Observable[_]) extends SingleParentStream[A, A] with InternalTryObserver[A] with SyncObservable[A]

Note: This is generally supposed to be used only with streams as inputs. Make sure you know what you're doing if using signals.

Note: This is generally supposed to be used only with streams as inputs. Make sure you know what you're doing if using signals.

  • if parent is a Signal, this stream mirrors parent.changes, not parent.
  • if after is a Signal, this stream ignores its initial value
class ThrottleStream[A](val parent: EventStream[A], intervalMs: Int, leading: Boolean) extends SingleParentStream[A, A] with InternalTryObserver[A]

ThrottleStream emits at most one event per intervalMs.

ThrottleStream 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 DebounceStream