- Companion:
- object
Value members
Concrete methods
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
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
Emit x
if parent stream emits Some(x)
, nothing otherwise
Emit x
if parent stream emits Some(x)
, nothing otherwise
- Value parameters:
- combinator
Must not throw!
- Value parameters:
- combinator
Must not throw!
- Value parameters:
- combinator
Must not throw!
- Value parameters:
- combinator
Must not throw!
- Value parameters:
- combinator
Must not throw!
- Value parameters:
- combinator
Must not throw!
- Value parameters:
- combinator
Must not throw!
See also debug convenience method in BaseObservable
See also debug convenience method in BaseObservable
- Definition Classes
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)
Distinct all values (both events and errors) using a comparison function
Distinct all values (both events and errors) using a comparison function
- Definition Classes
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
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
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
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)
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.
See docs for MapStream
See docs for MapStream
- Value parameters:
- pf
Note: guarded against exceptions
- Definition Classes
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
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
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!
Like split
, but uses index of the item in the list as the key.
Like split
, but uses index of the item in the list as the key.
This .split
-s a Stream of an Option by the Option's isDefined
property.
If you want a different key, use the .split operator directly.
This .split
-s a Stream of an Option by the Option's isDefined
property.
If you want a different key, use the .split operator directly.
- Value parameters:
- ifEmpty
- returned if Option is empty, or if the parent
stream
has not emitted any events yet. Re-evaluated whenever the parentstream
switches fromSome(a)
toNone
.ifEmpty
is NOT re-evaluated when the parentstream
emitsNone
if the last event it emitted was also aNone
.
- returned if Option is empty, or if the parent
- project
- (initialInput, signalOfInput) => output
project
is called whenever signal switches fromNone
toSome()
.signalOfInput
starts withinitialInput
value, and updates when the parentsignal
updates fromSome(a)
toSome(b)
.
- (initialInput, signalOfInput) => output
- 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)
- 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)
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
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
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
- 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)
- 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)
Deprecated methods
Inherited methods
Subscribe an external observer to this observable
Subscribe an external observer to this observable
- Inherited from:
- BaseObservable
Trigger JS debugger for emitted events and errors if when
passes
Note: for Signals this also triggers onStart (with the current value at the time)
Trigger JS debugger for emitted events and errors if when
passes
Note: for Signals this also triggers onStart (with the current value at the time)
- Inherited from:
- DebuggableObservable
Trigger JS debugger for emitted errors (but not events) if when
passes
Note: for Signals this also triggers onStart (if current value is an error)
Trigger JS debugger for emitted errors (but not events) if when
passes
Note: for Signals this also triggers onStart (if current value is an error)
- Inherited from:
- DebuggableObservable
Trigger JS debugger for emitted events (but not errors) if when
passes
Note: for Signals this also triggers onStart (if current value is not an error)
Trigger JS debugger for emitted events (but not errors) if when
passes
Note: for Signals this also triggers onStart (if current value is not an error)
- Inherited from:
- DebuggableObservable
Trigger JS debugger when the observable starts and stops
Trigger JS debugger when the observable starts and stops
- Inherited from:
- DebuggableObservable
Trigger JS debugger when the observable starts
Trigger JS debugger when the observable starts
- Inherited from:
- DebuggableObservable
Trigger JS debugger when the observable stops
Trigger JS debugger when the observable stops
- Inherited from:
- DebuggableObservable
Log emitted events and errors if when
condition passes, using dom.console.log if useJsLogger
is true.
Note: for Signals this also triggers on start (with the current value at the time)
Log emitted events and errors if when
condition passes, using dom.console.log if useJsLogger
is true.
Note: for Signals this also triggers on start (with the current value at the time)
- Inherited from:
- DebuggableObservable
Log emitted errors (but not regular events) if when
condition passes
Note: for Signals this also triggers onStart (if current value is an error)
Log emitted errors (but not regular events) if when
condition passes
Note: for Signals this also triggers onStart (if current value is an error)
- Inherited from:
- DebuggableObservable
Log emitted events (but not errors) if when
condition passes, using dom.console.log if useJsLogger
is true.
Note: for Signals this also triggers onStart (if current value is not an error)
Log emitted events (but not errors) if when
condition passes, using dom.console.log if useJsLogger
is true.
Note: for Signals this also triggers onStart (if current value is not an error)
- Inherited from:
- DebuggableObservable
Log when the observable starts and stops
Log when the observable starts and stops
- Inherited from:
- DebuggableObservable
Log when the observable starts
Log when the observable starts
- Inherited from:
- DebuggableObservable
Log when the observable stops
Log when the observable stops
- Inherited from:
- DebuggableObservable
Execute fn on every emitted event or error Note: for Signals this also triggers onStart (with the current value at the time)
Execute fn on every emitted event or error Note: for Signals this also triggers onStart (with the current value at the time)
- Inherited from:
- DebuggableObservable
Execute fn on every emitted error (but not regular events) Note: for Signals this also triggers onStart (if current value is an error)
Execute fn on every emitted error (but not regular events) Note: for Signals this also triggers onStart (if current value is an error)
- Inherited from:
- DebuggableObservable
Execute fn on every emitted event (but not error) Note: for Signals this also triggers onStart (if current value is not an error)
Execute fn on every emitted event (but not error) Note: for Signals this also triggers onStart (if current value is not an error)
- Inherited from:
- DebuggableObservable
Execute callbacks on when the observable starts and stops
Execute callbacks on when the observable starts and stops
- Value parameters:
- startFn
topoRank => ()
- Inherited from:
- DebuggableObservable
Execute callbacks on when the observable starts
Execute callbacks on when the observable starts
- Value parameters:
- fn
topoRank => ()
- Inherited from:
- DebuggableObservable
Execute callbacks on when the observable stops
Execute callbacks on when the observable stops
- Inherited from:
- DebuggableObservable
Return the observable's topoRank. This does not affect the observable in any way.
Return the observable's topoRank. This does not affect the observable in any way.
- Inherited from:
- DebuggableObservable
Create a new observable that listens to the original, and
set the displayName of the new observable.
This is different from setDisplayName
.
Create a new observable that listens to the original, and
set the displayName of the new observable.
This is different from setDisplayName
.
If you say stream.debugWithName("foo").debugLog()
, the displayName
used by the logger will be "foo" verbatim, whereas if you say
stream.setDisplayName("foo").debugLog()
, the logger's displayName
will be "foo|Debug" – with a suffix – to differentiate it from
the "foo" displayName of stream
itself.
- Inherited from:
- DebuggableObservable
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
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) using a comparison function
Distinct events (but keep all errors) using a comparison function
- 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) 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
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
- 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
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
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
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
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