class StreamFromSignal[A] extends SingleParentStream[A, A] with InternalTryObserver[A]
- Alphabetic
- By Inheritance
- StreamFromSignal
- InternalTryObserver
- SingleParentStream
- InternalObserver
- WritableStream
- WritableObservable
- EventStream
- EventSource
- Observable
- BaseObservable
- Named
- Source
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addExternalObserver(observer: Observer[A], owner: Owner): Subscription
Subscribe an external observer to this observable
Subscribe an external observer to this observable
- Attributes
- protected[this]
- Definition Classes
- WritableObservable → BaseObservable
- def addInternalObserver(observer: InternalObserver[A], shouldCallMaybeWillStart: Boolean): Unit
Child observable should call this method on its parents when it is started.
Child observable should call this method on its parents when it is started. This observable calls onStart if this action has given it its first observer (internal or external).
- Attributes
- protected[airstream]
- Definition Classes
- WritableObservable → BaseObservable
- def addObserver(observer: Observer[A])(implicit owner: Owner): Subscription
Subscribe an external observer to this observable
Subscribe an external observer to this observable
- Definition Classes
- WritableObservable → BaseObservable
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def collect[B](pf: PartialFunction[A, B]): EventStream[B]
Apply
pf
to event and emit the resulting value, or emit nothing ifpf
is not defined for that event.Apply
pf
to event and emit the resulting value, or emit nothing ifpf
is not defined for that event.- pf
Note: guarded against exceptions
- Definition Classes
- EventStream
- def collectOpt[B](fn: (A) => Option[B]): EventStream[B]
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)- fn
Note: guarded against exceptions
- Definition Classes
- EventStream
- def collectSome[B](implicit ev: <:<[A, Option[B]]): EventStream[B]
Emit
x
if parent stream emitsSome(x)
, nothing otherwiseEmit
x
if parent stream emitsSome(x)
, nothing otherwise- Definition Classes
- EventStream
- def compose[B](operator: (EventStream[A]) => EventStream[B]): EventStream[B]
- Definition Classes
- EventStream
- def debounce(ms: Int): EventStream[A]
See docs for DebounceStream
See docs for DebounceStream
- Definition Classes
- EventStream
- def debugWith(debugger: Debugger[A]): EventStream[A]
See also debug convenience method in BaseObservable
See also debug convenience method in BaseObservable
- Definition Classes
- EventStream → BaseObservable
- def defaultDisplayName: String
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.
- Attributes
- protected
- Definition Classes
- Named
- def delay(ms: Int = 0): EventStream[A]
- ms
milliseconds of delay
- Definition Classes
- EventStream
- def delaySync(after: EventStream[_]): EventStream[A]
Make a stream that emits this stream's values but waits for
after
stream to emit first in a given transaction.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 withSignal.composeChanges
(see docs for more details)- Definition Classes
- EventStream
- final def displayName: String
- Definition Classes
- Named
- def distinct: EventStream[A]
Distinct events (but keep all errors) by == (equals) comparison
Distinct events (but keep all errors) by == (equals) comparison
- Definition Classes
- BaseObservable
- def distinctBy(key: (A) => Any): EventStream[A]
Distinct events (but keep all errors) by matching key Note:
key(event)
might be evaluated more than once for each eventDistinct events (but keep all errors) by matching key Note:
key(event)
might be evaluated more than once for each event- Definition Classes
- BaseObservable
- def distinctByFn(isSame: (A, A) => Boolean): EventStream[A]
Distinct events (but keep all errors) using a comparison function
Distinct events (but keep all errors) using a comparison function
- Definition Classes
- BaseObservable
- def distinctByRef(implicit ev: <:<[A, AnyRef]): EventStream[A]
Distinct events (but keep all errors) by reference equality (eq)
Distinct events (but keep all errors) by reference equality (eq)
- Definition Classes
- BaseObservable
- def distinctErrors(isSame: (Throwable, Throwable) => Boolean): EventStream[A]
Distinct errors only (but keep all events) using a comparison function
Distinct errors only (but keep all events) using a comparison function
- Definition Classes
- BaseObservable
- def distinctTry(isSame: (Try[A], Try[A]) => Boolean): EventStream[A]
Distinct all values (both events and errors) using a comparison function
Distinct all values (both events and errors) using a comparison function
- Definition Classes
- EventStream → BaseObservable
- def drop(numEvents: Int, resetOnStop: Boolean = false): EventStream[A]
Drop (skip) the first
numEvents
events from this stream.Drop (skip) the first
numEvents
events from this stream. Note: errors are NOT dropped.- resetOnStop
Reset the count if the stream stops
- Definition Classes
- EventStream
- def dropUntil(passes: (A) => Boolean, resetOnStop: Boolean = false): EventStream[A]
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.
- passes
Note: MUST NOT THROW!
- resetOnStop
Forget everything and start dropping again if the stream stops
- Definition Classes
- EventStream
- def dropWhile(passes: (A) => Boolean, resetOnStop: Boolean = false): EventStream[A]
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.
- passes
Note: MUST NOT THROW!
- resetOnStop
Forget everything and start dropping again if the stream stops
- Definition Classes
- EventStream
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def equals(obj: Any): Boolean
Airstream may internally use Scala library functions which use
==
orhashCode
for equality, for example List.contains.Airstream may internally use Scala library functions which use
==
orhashCode
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 acase class
subclass, and the Scala compiler will generate a structural-equalityequals
andhashCode
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 → AnyRef → Any
- val externalObservers: ObserverList[Observer[A]]
Note: Observer can be added more than once to an Observable.
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.
- Attributes
- protected
- Definition Classes
- WritableObservable
- def filter(passes: (A) => Boolean): EventStream[A]
- passes
Note: guarded against exceptions
- Definition Classes
- EventStream
- def filterNot(predicate: (A) => Boolean): EventStream[A]
- Definition Classes
- EventStream
- def filterWith[B](source: SignalSource[B], passes: (B) => Boolean): EventStream[A]
stream.filterWith(otherSignal, passes = _ == false)
is essentially likestream.filter(_ => otherSignal.now() == false)
(but it compiles)stream.filterWith(otherSignal, passes = _ == false)
is essentially likestream.filter(_ => otherSignal.now() == false)
(but it compiles)- Definition Classes
- EventStream
- def fireError(nextError: Throwable, transaction: Transaction): Unit
- Attributes
- protected[this]
- Definition Classes
- WritableStream → WritableObservable
- final def fireTry(nextValue: Try[A], transaction: Transaction): Unit
- Attributes
- protected[this]
- Definition Classes
- WritableStream → WritableObservable
- def fireValue(nextValue: A, transaction: Transaction): Unit
- Attributes
- protected[this]
- Definition Classes
- WritableStream → WritableObservable
- def flatMap[B, Inner[_], Output[+_] <: Observable[_]](compose: (A) => Inner[B])(implicit strategy: FlattenStrategy[[+_]EventStream[_], Inner, Output]): Output[B]
- compose
Note: guarded against exceptions
- Definition Classes
- BaseObservable
- Annotations
- @inline()
- def foreach(onNext: (A) => Unit)(implicit owner: Owner): Subscription
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
- Definition Classes
- BaseObservable
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getOrCreatePendingObserverRemovals: JsArray[() => Unit]
- Attributes
- protected
- Definition Classes
- BaseObservable
- final def hashCode(): Int
Force reference equality checks.
Force reference equality checks. See comment for
equals
.- Definition Classes
- BaseObservable → AnyRef → Any
- val internalObservers: ObserverList[InternalObserver[A]]
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
- Attributes
- protected
- Definition Classes
- WritableObservable
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val isSafeToRemoveObserver: Boolean
- Attributes
- protected
- Definition Classes
- BaseObservable
- def isStarted: Boolean
- Attributes
- protected
- Definition Classes
- BaseObservable
- def map[B](project: (A) => B): EventStream[B]
- project
Note: guarded against exceptions
- Definition Classes
- EventStream → BaseObservable
- def mapTo[B](value: => B): EventStream[B]
value
is passed by name, so it will be evaluated whenever the Observable fires.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
Note: guarded against exceptions
- Definition Classes
- BaseObservable
- def mapToStrict[B](value: B): EventStream[B]
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
- Definition Classes
- BaseObservable
- def mapToUnit: EventStream[Unit]
- Definition Classes
- BaseObservable
- def matchStreamOrSignal[B](ifStream: (EventStream[A]) => B, ifSignal: (Signal[A]) => B): B
- Definition Classes
- BaseObservable
- val maybeDisplayName: UndefOr[String]
This name should identify the instance (observable or observer) uniquely enough for your purposes.
This name should identify the instance (observable or observer) uniquely enough for your purposes. You can read / write it to simplify debugging. Airstream uses this in
debugLog*
methods. In the future, we will expand on this. #TODO[Debug] We don't use this to its full potential yet.- Attributes
- protected[this]
- Definition Classes
- Named
- val maybePendingObserverRemovals: UndefOr[JsArray[() => Unit]]
Observer removals scheduled to run as soon as this observable's event propagation finishes.
Observer removals scheduled to run as soon as this observable's event propagation finishes. Only put calls to
removeInternalObserverNow
andremoveExternalObserverNow
here, no custom logic.- Attributes
- protected
- Definition Classes
- BaseObservable
- def maybeWillStart(): Unit
- Attributes
- protected
- Definition Classes
- BaseObservable
- def mergeWith[B >: A](streams: EventStream[B]*): EventStream[B]
Returns a stream that emits events from this stream AND all off the
streams
, interleaved.Returns a stream that emits events from this stream AND all off the
streams
, interleaved. Note: For other types of combination, seecombineWith
,withCurrentValueOf
,sample
etc.- Definition Classes
- EventStream
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def numAllObservers: Int
Total number of internal and external observers
Total number of internal and external observers
- Attributes
- protected
- Definition Classes
- WritableObservable → BaseObservable
- def onAddedExternalObserver(observer: Observer[A]): Unit
This is used in Signal-s.
This is used in Signal-s. It's a no-op for Streams.
- Attributes
- protected
- Definition Classes
- EventStream → BaseObservable
- final def onError(nextError: Throwable, transaction: Transaction): Unit
Must not throw
Must not throw
- Attributes
- protected
- Definition Classes
- InternalTryObserver → InternalObserver
- final def onNext(nextValue: A, transaction: Transaction): Unit
Must not throw
Must not throw
- Attributes
- protected
- Definition Classes
- InternalTryObserver → InternalObserver
- def onStart(): Unit
This method is fired when this observable starts working (listening for parent events and/or firing its own events), that is, when it gets its first Observer (internal or external).
This method is fired when this observable starts working (listening for parent events and/or firing its own events), that is, when it gets its first Observer (internal or external).
onStart can potentially be called multiple times, the second time being after it has stopped (see onStop).
- Attributes
- protected[this]
- Definition Classes
- StreamFromSignal → SingleParentStream → BaseObservable
- def onStop(): Unit
This method is fired when this observable stops working (listening for parent events and/or firing its own events), that is, when it loses its last Observer (internal or external).
This method is fired when this observable stops working (listening for parent events and/or firing its own events), that is, when it loses its last Observer (internal or external).
onStop can potentially be called multiple times, the second time being after it has started again (see onStart).
- Attributes
- protected[this]
- Definition Classes
- SingleParentStream → BaseObservable
- def onTry(nextValue: Try[A], transaction: Transaction): Unit
Must not throw
Must not throw
- Attributes
- protected
- Definition Classes
- StreamFromSignal → InternalObserver
- def onWillStart(): Unit
When starting an observable, this is called recursively on every one of its parents that are not started.
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.
- Attributes
- protected
- Definition Classes
- SingleParentStream → BaseObservable
- val parent: Signal[A]
- Attributes
- protected[this]
- Definition Classes
- StreamFromSignal → SingleParentStream
- implicit def protectedAccessEvidence: Protected
- Attributes
- protected
- Definition Classes
- BaseObservable
- Annotations
- @inline()
- def recover[B >: A](pf: PartialFunction[Throwable, Option[B]]): EventStream[B]
See docs for MapStream
See docs for MapStream
- pf
Note: guarded against exceptions
- Definition Classes
- EventStream → BaseObservable
- def recoverIgnoreErrors: EventStream[A]
- Definition Classes
- BaseObservable
- def recoverToTry: EventStream[Try[A]]
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
- EventStream → BaseObservable
- def removeExternalObserver(observer: Observer[A]): Unit
Note: do not expose this to end users.
Note: do not expose this to end users. See https://github.com/raquo/Airstream/issues/10
Removal still happens synchronously, just after we're done iterating over this observable's observers, to avoid interference with that logic.
Note: The delay is necessary not just because of interference with actual while(index < observers.length) iteration, but also because on a high level it is too risky to remove observers from arbitrary observables while the propagation is running. This would mean that some graphs would not propagate fully, which would break very basic expectations of end users.
UPDATE: In 15.0.0 we made the observable removal delay more fine grained – previously we would wait until the whole transaction completed before removing observers, now we only wait until this observable's iteration is done. This helped us fix https://github.com/raquo/Airstream/issues/95
Note: To completely unsubscribe an Observer from this Observable, you need to remove it as many times as you added it to this Observable.
- Attributes
- protected[airstream]
- Definition Classes
- BaseObservable
- def removeExternalObserverNow(observer: Observer[A]): Unit
- Attributes
- protected[airstream]
- Definition Classes
- WritableObservable → BaseObservable
- def removeInternalObserver(observer: InternalObserver[A]): Unit
Safely remove internal observer (such that it doesn't interfere with iteration over the list of observers).
Safely remove internal observer (such that it doesn't interfere with iteration over the list of observers). Removal still happens synchronously, just after we're done iterating over this observable's observers.
Child observable should call this method on its parents when it is stopped.
- Attributes
- protected[airstream]
- Definition Classes
- BaseObservable
- def removeInternalObserverNow(observer: InternalObserver[A]): Unit
Child observable should call parent.removeInternalObserver(childInternalObserver) when it is stopped.
Child observable should call parent.removeInternalObserver(childInternalObserver) when it is stopped. This observable calls onStop if this action has removed its last observer (internal or external).
- Attributes
- protected[airstream]
- Definition Classes
- WritableObservable → BaseObservable
- def scanLeft[B](initial: B)(fn: (B, A) => B): Signal[B]
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.
- fn
Note: guarded against exceptions
- Definition Classes
- EventStream
- def scanLeftRecover[B](initial: Try[B])(fn: (Try[B], Try[A]) => Try[B]): Signal[B]
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.
- fn
Note: Must not throw!
- Definition Classes
- EventStream
- def setDisplayName(name: String): StreamFromSignal.this.type
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- Definition Classes
- Named
- def startWith[B >: A](initial: => B, cacheInitialValue: Boolean = false): Signal[B]
- 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)
- Definition Classes
- EventStream
- Annotations
- @inline()
- def startWithNone: Signal[Option[A]]
- Definition Classes
- EventStream
- Annotations
- @inline()
- def startWithTry[B >: A](initial: => Try[B], cacheInitialValue: Boolean = false): Signal[B]
- 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)
- Definition Classes
- EventStream
- Annotations
- @inline()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def take(numEvents: Int, resetOnStop: Boolean = false): EventStream[A]
Take the first
numEvents
events from this stream, ignore the rest.Take the first
numEvents
events from this stream, ignore the rest. Note: As long as events are being taken, ALL errors are also taken- resetOnStop
Reset the count if the stream stops
- Definition Classes
- EventStream
- def takeUntil(passes: (A) => Boolean, resetOnStop: Boolean = false): EventStream[A]
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.
- passes
Note: MUST NOT THROW!
- resetOnStop
Forget everything and start dropping again if the stream stops
- Definition Classes
- EventStream
- def takeWhile(passes: (A) => Boolean, resetOnStop: Boolean = false): EventStream[A]
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.
- passes
Note: MUST NOT THROW!
- resetOnStop
Forget everything and start dropping again if the stream stops
- Definition Classes
- EventStream
- def throttle(ms: Int, leading: Boolean = true): EventStream[A]
See docs for ThrottleStream
See docs for ThrottleStream
- Definition Classes
- EventStream
- def throwFailure[B](implicit ev: <:<[A, Try[B]]): EventStream[B]
Unwrap Try to "undo"
recoverToTry
– Encode Failure(err) as observable errors, and Success(v) as eventsUnwrap Try to "undo"
recoverToTry
– Encode Failure(err) as observable errors, and Success(v) as events- Definition Classes
- BaseObservable
- def toObservable: EventStream[A]
- Definition Classes
- EventStream → EventSource → Source
- def toSignal[B >: A](initial: => B, cacheInitialValue: Boolean = false): Signal[B]
- 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)
- Definition Classes
- EventStream
- def toSignalIfStream[B >: A](ifStream: (EventStream[A]) => Signal[B]): Signal[B]
- Definition Classes
- BaseObservable
- def toSignalWithTry[B >: A](initial: => Try[B], cacheInitialValue: Boolean = false): Signal[B]
- 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)
- Definition Classes
- EventStream
- def toStreamIfSignal[B >: A](ifSignal: (Signal[A]) => EventStream[B]): EventStream[B]
- Definition Classes
- BaseObservable
- final def toString(): String
Override defaultDisplayName instead of this, if you need to.
Override defaultDisplayName instead of this, if you need to.
- Definition Classes
- Named → AnyRef → Any
- def toWeakSignal: Signal[Option[A]]
Convert this observable to a signal of Option[A].
Convert this observable to a signal of Option[A]. If it is a stream, set initial value to None.
- Definition Classes
- BaseObservable
- val topoRank: Int
Note: Use Protected.topoRank(observable) to read another observable's topoRank if needed
Note: Use Protected.topoRank(observable) to read another observable's topoRank if needed
- Attributes
- protected
- Definition Classes
- StreamFromSignal → BaseObservable
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
- def foldLeft[B](initial: B)(fn: (B, A) => B): Signal[B]
- Definition Classes
- EventStream
- Annotations
- @deprecated
- Deprecated
(Since version 15.0.0-M1) foldLeft was renamed to scanLeft
- def foldLeftRecover[B](initial: Try[B])(fn: (Try[B], Try[A]) => Try[B]): Signal[B]
- Definition Classes
- EventStream
- Annotations
- @deprecated
- Deprecated
(Since version 15.0.0-M1) foldLeftRecover was renamed to scanLeftRecover