com.raquo.airstream.timing
Type members
Classlikes
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
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
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.
- Value Params
- next
(currentState => (nextState, nextIntervalMs) Note: guarded against exceptions. If
next
throws, stream will emit that error
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