CollectStream
This stream applies fn
to the parent stream's events, and emits x
from the resulting Some(x)
value (if None
, nothing is fired).
This stream emits an error if the parent stream emits an error (Note: no filtering applied), or if fn
throws
- Value parameters:
- fn
Note: guarded against exceptions
Value members
Inherited methods
Subscribe an external observer to this observable
Subscribe an external observer to this observable
- Definition Classes
- Inherited from:
- WritableObservable
Apply pf
to event and emit the resulting value, or emit nothing if pf
is not defined for that event.
Apply pf
to event and emit the resulting value, or emit nothing if pf
is not defined for that event.
- Value parameters:
- pf
Note: guarded against exceptions
- Inherited from:
- EventStream
Apply fn
to parent stream event, and emit resulting x if it returns Some(x)
Apply fn
to parent stream event, and emit resulting x if it returns Some(x)
- Value parameters:
- fn
Note: guarded against exceptions
- Inherited from:
- EventStream
Emit x
if parent stream emits Some(x)
, nothing otherwise
Emit x
if parent stream emits Some(x)
, nothing otherwise
- Inherited from:
- EventStream
See also debug convenience method in BaseObservable
See also debug convenience method in BaseObservable
- Definition Classes
- Inherited from:
- EventStream
This is the method that subclasses override to preserve the user's ability to set custom display names.
This is the method that subclasses override to preserve the user's ability to set custom display names.
- Inherited from:
- Named
Make a stream that emits this stream's values but waits for after
stream to emit first in a given transaction.
You can use this for Signals too with Signal.composeChanges
(see docs for more details)
Make a stream that emits this stream's values but waits for after
stream to emit first in a given transaction.
You can use this for Signals too with Signal.composeChanges
(see docs for more details)
- Inherited from:
- EventStream
Distinct events (but keep all errors) by == (equals) comparison
Distinct events (but keep all errors) by == (equals) comparison
- Inherited from:
- BaseObservable
Distinct events (but keep all errors) by matching key
Note: key(event)
might be evaluated more than once for each event
Distinct events (but keep all errors) by matching key
Note: key(event)
might be evaluated more than once for each event
- Inherited from:
- BaseObservable
Distinct events (but keep all errors) using a comparison function
Distinct events (but keep all errors) using a comparison function
- Inherited from:
- BaseObservable
Distinct events (but keep all errors) by reference equality (eq)
Distinct events (but keep all errors) by reference equality (eq)
- Inherited from:
- BaseObservable
Distinct errors only (but keep all events) using a comparison function
Distinct errors only (but keep all events) using a comparison function
- Inherited from:
- BaseObservable
Distinct all values (both events and errors) using a comparison function
Distinct all values (both events and errors) using a comparison function
- Definition Classes
- Inherited from:
- EventStream
Drop (skip) the first numEvents
events from this stream. Note: errors are NOT dropped.
Drop (skip) the first numEvents
events from this stream. Note: errors are NOT dropped.
- Value parameters:
- resetOnStop
Reset the count if the stream stops
- Inherited from:
- EventStream
Drop (skip) events from this stream as long as they do NOT pass the test (as soon as they start passing, stop dropping) Note: errors are NOT dropped.
Drop (skip) events from this stream as long as they do NOT pass the test (as soon as they start passing, stop dropping) Note: errors are NOT dropped.
- Value parameters:
- passes
Note: MUST NOT THROW!
- resetOnStop
Forget everything and start dropping again if the stream stops
- Inherited from:
- EventStream
Drop (skip) events from this stream as long as they pass the test (as soon as they stop passing, stop dropping) Note: errors are NOT dropped.
Drop (skip) events from this stream as long as they pass the test (as soon as they stop passing, stop dropping) Note: errors are NOT dropped.
- Value parameters:
- passes
Note: MUST NOT THROW!
- resetOnStop
Forget everything and start dropping again if the stream stops
- Inherited from:
- EventStream
Airstream may internally use Scala library functions which use ==
or hashCode
for equality, for example List.contains.
Comparing observables by structural equality pretty much never makes sense, yet it's not that hard to run into that, all
you need is to create a case class
subclass, and the Scala compiler will generate a structural-equality equals
and
hashCode
methods for you behind the scenes.
Airstream may internally use Scala library functions which use ==
or hashCode
for equality, for example List.contains.
Comparing observables by structural equality pretty much never makes sense, yet it's not that hard to run into that, all
you need is to create a case class
subclass, and the Scala compiler will generate a structural-equality equals
and
hashCode
methods for you behind the scenes.
To prevent that, we make equals and hashCode methods final, using the default implementation (which is reference equality).
- Definition Classes
- BaseObservable -> Any
- Inherited from:
- BaseObservable
stream.filterWith(otherSignal, passes = _ == false)
is essentially like
stream.filter(_ => otherSignal.now() == false)
(but it compiles)
stream.filterWith(otherSignal, passes = _ == false)
is essentially like
stream.filter(_ => otherSignal.now() == false)
(but it compiles)
- Inherited from:
- EventStream
- Value parameters:
- compose
Note: guarded against exceptions
- Inherited from:
- BaseObservable
Create an external observer from a function and subscribe it to this observable.
Create an external observer from a function and subscribe it to this observable.
Note: since you won't have a reference to the observer, you will need to call Subscription.kill() to unsubscribe
- Inherited from:
- BaseObservable
Force reference equality checks. See comment for equals
.
Force reference equality checks. See comment for equals
.
- Definition Classes
- BaseObservable -> Any
- Inherited from:
- BaseObservable
- Value parameters:
- project
Note: guarded against exceptions
- Definition Classes
- Inherited from:
- EventStream
value
is passed by name, so it will be evaluated whenever the Observable fires.
Use it to sample mutable values (e.g. myInput.ref.value in Laminar).
value
is passed by name, so it will be evaluated whenever the Observable fires.
Use it to sample mutable values (e.g. myInput.ref.value in Laminar).
See also: mapToStrict
- Value parameters:
- value
Note: guarded against exceptions
- Inherited from:
- BaseObservable
value
is evaluated strictly, only once, when this method is called.
value
is evaluated strictly, only once, when this method is called.
See also: mapTo
- Inherited from:
- BaseObservable
Returns a stream that emits events from this stream AND all off the streams
, interleaved.
Note: For other types of combination, see combineWith
, withCurrentValueOf
, sample
etc.
Returns a stream that emits events from this stream AND all off the streams
, interleaved.
Note: For other types of combination, see combineWith
, withCurrentValueOf
, sample
etc.
- Inherited from:
- EventStream
Total number of internal and external observers
Total number of internal and external observers
- Definition Classes
- Inherited from:
- WritableObservable
When starting an observable, this is called recursively on every one of its parents that are not started. This whole chain happens before onStart callback is called. This chain serves to prepare the internal states of observables that are about to start, e.g. you should update the signal's value to match its parent signal's value in this callback, if applicable.
When starting an observable, this is called recursively on every one of its parents that are not started. This whole chain happens before onStart callback is called. This chain serves to prepare the internal states of observables that are about to start, e.g. you should update the signal's value to match its parent signal's value in this callback, if applicable.
Default implementation, for observables that don't need anything,
should be to call parent.maybeWillStart()
for every parent observable.
If custom behaviour is required, you should generally call parent.maybeWillStart()
BEFORE your custom logic. Then your logic will be able to make use of parent's
updated value.
Note: THIS METHOD MUST NOT CREATE TRANSACTIONS OR FIRE ANY EVENTS! DO IT IN ONSTART IF NEEDED.
- Definition Classes
- Inherited from:
- SingleParentStream
See docs for MapStream
See docs for MapStream
- Value parameters:
- pf
Note: guarded against exceptions
- Definition Classes
- Inherited from:
- EventStream
Convert this to an observable that emits Failure(err) instead of erroring
Convert this to an observable that emits Failure(err) instead of erroring
- Definition Classes
- Inherited from:
- EventStream
A signal that emits the accumulated value every time that the parent stream emits.
A signal that emits the accumulated value every time that the parent stream emits.
- Value parameters:
- fn
Note: guarded against exceptions
- Inherited from:
- EventStream
A signal that emits the accumulated value every time that the parent stream emits.
A signal that emits the accumulated value every time that the parent stream emits.
- Value parameters:
- fn
Note: Must not throw!
- Inherited from:
- EventStream
Set the display name for this instance (observable or observer).
Set the display name for this instance (observable or observer).
- This method modifies the instance and returns
this
. It does not create a new instance. - New name you set will override the previous name, if any. This might change in the future. For the sake of sanity, don't call this more than once for the same instance.
- If display name is set, toString will output it instead of the standard type@hashcode string
- Inherited from:
- Named
- Value parameters:
- cacheInitialValue
if false, signal's initial value will be re-evaluated on every restart (so long as the parent stream does not emit any values)
- Inherited from:
- EventStream
- Value parameters:
- cacheInitialValue
if false, signal's initial value will be re-evaluated on every restart (so long as the parent stream does not emit any values)
- Inherited from:
- EventStream
Take the first numEvents
events from this stream, ignore the rest.
Note: As long as events are being taken, ALL errors are also taken
Take the first numEvents
events from this stream, ignore the rest.
Note: As long as events are being taken, ALL errors are also taken
- Value parameters:
- resetOnStop
Reset the count if the stream stops
- Inherited from:
- EventStream
Imitate parent stream as long as events to NOT pass the test; stop emitting after that.
Imitate parent stream as long as events to NOT pass the test; stop emitting after that.
- Value parameters:
- passes
Note: MUST NOT THROW!
- resetOnStop
Forget everything and start dropping again if the stream stops
- Inherited from:
- EventStream
Imitate parent stream as long as events pass the test; stop emitting after that.
Imitate parent stream as long as events pass the test; stop emitting after that.
- Value parameters:
- passes
Note: MUST NOT THROW!
- resetOnStop
Forget everything and start dropping again if the stream stops
- Inherited from:
- EventStream
Unwrap Try to "undo" recoverToTry
– Encode Failure(err) as observable errors, and Success(v) as events
Unwrap Try to "undo" recoverToTry
– Encode Failure(err) as observable errors, and Success(v) as events
- Inherited from:
- BaseObservable
- Value parameters:
- cacheInitialValue
if false, signal's initial value will be re-evaluated on every restart (so long as the parent stream does not emit any values)
- Inherited from:
- EventStream
- Value parameters:
- cacheInitialValue
if false, signal's initial value will be re-evaluated on every restart (so long as the parent stream does not emit any values)
- Inherited from:
- EventStream
Override defaultDisplayName instead of this, if you need to.
Override defaultDisplayName instead of this, if you need to.
Convert this observable to a signal of Option[A]. If it is a stream, set initial value to None.
Convert this observable to a signal of Option[A]. If it is a stream, set initial value to None.
- Inherited from:
- BaseObservable
Deprecated and Inherited methods
Inherited fields
Note: Observer can be added more than once to an Observable. If so, it will observe each event as many times as it was added.
Note: Observer can be added more than once to an Observable. If so, it will observe each event as many times as it was added.
- Inherited from:
- WritableObservable
Note: This is enforced to be a Set outside of the type system #performance
Note: This is enforced to be a Set outside of the type system #performance
- Inherited from:
- WritableObservable