CombineLatest(*publishers, map_: Callable[..., Any] = None, emit_on=None, allow_stateless=False)¶
Combine the latest emit of multiple publishers and emit the combination
- publishers – source publishers
- map – optional function to be called for evaluation of current state
- emit_on – publisher or list of publishers - only emitting result when emit comes from one of this list. If None, emit on any source publisher.
- allow_stateless – when True evaluation is also done for stateless publishers. A stateless publisher without an emit will be hold as NONE.
>>> from broqer import Subject, op >>> s1 = Subject() >>> s2 = Subject()
>>> combination = op.CombineLatest(s1, s2) >>> disposable = combination | op.Sink(print)
CombineLatest is only emitting, when all values are collected:
>>> s1.emit(1) >>> s2.emit(2) (1, 2) >>> s2.emit(3) (1, 3)
Subscribing to a CombineLatest with all values available is emitting the values immediate on subscription:
>>> combination | op.Sink(print, 'Second sink:') Second sink: (1, 3) <...>