Skip to content

Commit

Permalink
Docs: Fix bullet point formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
raquo committed Jan 16, 2025
1 parent c38e4a1 commit c3bc01d
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.raquo.airstream.split.MacrosUtilities.{CaseAny, HandlerAny, MatchType
*
* ```scala
* fooSignal.splitMatchOne
* .splitType[Baz] { (baz, bazSignal) => renderBazNode(baz, bazSignal) }
* .handleType[Baz] { (baz, bazSignal) => renderBazNode(baz, bazSignal) }
* ```
*
* will be expanded sematically into:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ trait SingleParentSignal[I, O] extends WritableSignal[O] with InternalTryObserve
protected[this] var _parentLastUpdateId: Int = -1

/** Note: this is overriden in:
* - [[com.raquo.airstream.misc.SignalFromStream]] because parent can be stream, and it has cacheInitialValue logic
* - [[com.raquo.airstream.split.SplitChildSignal]] because its parent is a special timing stream, not the real parent
* - [[com.raquo.airstream.misc.SignalFromStream]] because parent can be stream, and it has cacheInitialValue logic
* - [[com.raquo.airstream.split.SplitChildSignal]] because its parent is a special timing stream, not the real parent
*/
override protected def onWillStart(): Unit = {
// dom.console.log(s"${this} > onWillStart (SPS)")
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/raquo/airstream/core/EventStream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ object EventStream {
}

/** Create a stream from a [[java.util.concurrent.Flow.Publisher]]
* - Use this to bring in events from other streaming libraries
* that can provide a `Flow.Publisher`, such as FS2 an Monix.
* - Use this to bring in events from other streaming libraries
* that can provide a `Flow.Publisher`, such as FS2 an Monix.
*/
def fromPublisher[A](publisher: Flow.Publisher[A], emitOnce: Boolean = false): EventStream[A] = {
FlowPublisherStream(publisher, emitOnce)
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/com/raquo/airstream/core/Named.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ trait Named {
final def displayName: String = maybeDisplayName.getOrElse(defaultDisplayName)

/** 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
* - 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
*/
def setDisplayName(name: String): this.type = {
maybeDisplayName = name // @TODO[Warn] Maybe we should emit a warning if name was already set
Expand Down
14 changes: 7 additions & 7 deletions src/main/scala/com/raquo/airstream/core/Signal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ object Signal {

// TODO[API] do we need this?
/** A stream from js.Promise that kind-of sort-of behaves like a signal:
* - It only every emits once, when the promise resolves.
* - If you miss that event because this stream got stopped before the
* promise resolved, you will receive that event when you start this
* stream again
* - However, if this stream was not stopped, new subscribers will not
* receive the event. If you need such behaviour, use a proper signal
* instead.
* - It only every emits once, when the promise resolves.
* - If you miss that event because this stream got stopped before the
* promise resolved, you will receive that event when you start this
* stream again
* - However, if this stream was not stopped, new subscribers will not
* receive the event. If you need such behaviour, use a proper signal
* instead.
*/
// def fromJsPromiseToStream[A](promise: js.Promise[A]): EventStream[A] = {
// new JsPromiseSignal(promise).changes.map(_.get)
Expand Down
16 changes: 8 additions & 8 deletions src/main/scala/com/raquo/airstream/core/Transaction.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import scala.scalajs.js
/** Transaction is a moment in time during which Airstream guarantees no FRP glitches.
*
* Some observables need to emit their events in new transactions. Roughly speaking:
* - All async observables (e.g. delay(100))
* - All observables that can create loops in the observable graph (e.g. flatMapSwitch)
* - All observables that get their events from outside of Airstream (e.g. custom sources)
* - All async observables (e.g. delay(100))
* - All observables that can create loops in the observable graph (e.g. flatMapSwitch)
* - All observables that get their events from outside of Airstream (e.g. custom sources)
*
* An observable can only emit once in a given transaction.
* - See [[MergeStream]] or [[CustomSource]] for examples of handling that.
* - See [[MergeStream]] or [[CustomSource]] for examples of handling that.
*
* See the docs for more details.
*
Expand Down Expand Up @@ -110,10 +110,10 @@ object Transaction {
*
* It is very hard to deliberately write valid code that would hit this
* limit. If you are hitting this limit, most likely:
* - There is an (unterminated) infinite loop in your observable graph,
* e.g. two Var-s updating each other recursively, or
* - You are doing something that looks a lot like that for the first
* `maxDepth` transactions.
* - There is an (unterminated) infinite loop in your observable graph,
* e.g. two Var-s updating each other recursively, or
* - You are doing something that looks a lot like that for the first
* `maxDepth` transactions.
*
* You probably need to adjust your code instead of raising this limit,
* but if you have a valid need for raising it, please let me know.
Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/com/raquo/airstream/custom/CustomSource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import scala.util.Try
/** Base functionality for a custom observable based on start and stop callbacks.
*
* See:
* - [[com.raquo.airstream.custom.CustomStreamSource]]
* - [[com.raquo.airstream.custom.CustomSignalSource]]
* - [[com.raquo.airstream.custom.CustomStreamSource]]
* - [[com.raquo.airstream.custom.CustomSignalSource]]
*/
trait CustomSource[A] extends WritableObservable[A] {

Expand Down Expand Up @@ -52,10 +52,10 @@ object CustomSource {
) { self =>

/** Create a version of a config that only runs start / stop if the predicate passes.
* - `start` will be run when the CustomSource is about to start
* if `passes` returns true at that time
* - `stop` will be run when the CustomSource is about to stop
* if your `start` code ran the last time CustomSource started
* - `start` will be run when the CustomSource is about to start
* if `passes` returns true at that time
* - `stop` will be run when the CustomSource is about to stop
* if your `start` code ran the last time CustomSource started
*/
def when(passes: () => Boolean): Config = {
var passed = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import com.raquo.ew.JsArray
import scala.util.{Failure, Success}

/** This is essentially a dynamic version of `EventStream.merge`.
* - The resulting stream re-emits all the events emitted by all of the streams
* previously emitted by the input observable.
* - If you restart the resulting stream, it will remember and resubscribe to all of the
* streams it previously listened to.
* - If the input observable emits the same stream more than once, that stream will only be added once.
* - The resulting stream re-emits all the events emitted by all of the streams
* previously emitted by the input observable.
* - If you restart the resulting stream, it will remember and resubscribe to all of the
* streams it previously listened to.
* - If the input observable emits the same stream more than once, that stream will only be added once.
*/
class ConcurrentStream[A](
parent: Observable[EventStream[A]]
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/com/raquo/airstream/misc/MapSignal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import scala.util.{Failure, Success, Try}
/** This signal emits an error if the parent observable emits an error or if `project` throws
*
* If `recover` is defined and needs to be called, it can do the following:
* - Return Some(value) to make this signal emit value
* - Return None to make this signal ignore (swallow) this error
* - Not handle the error (meaning .isDefinedAt(error) must be false) to emit the original error
* - Return Some(value) to make this signal emit value
* - Return None to make this signal ignore (swallow) this error
* - Not handle the error (meaning .isDefinedAt(error) must be false) to emit the original error
*
* @param project Note: guarded against exceptions
* @param recover Note: guarded against exceptions
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/com/raquo/airstream/misc/MapStream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import scala.util.Try
* This stream emits an error if the parent observable emits an error or if `project` throws
*
* If `recover` is defined and needs to be called, it can do the following:
* - Return Some(value) to make this stream emit value
* - Return None to make this stream ignore (swallow) this error
* - Not handle the error (meaning .isDefinedAt(error) must be false) to emit the original error
* - Return Some(value) to make this stream emit value
* - Return None to make this stream ignore (swallow) this error
* - Not handle the error (meaning .isDefinedAt(error) must be false) to emit the original error
*
* If `recover` throws an exception, it will be wrapped in `ErrorHandlingError` and propagated.
*
Expand Down
16 changes: 8 additions & 8 deletions src/main/scala/com/raquo/airstream/ownership/Owner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import com.raquo.ew.JsArray
import scala.annotation.unused

/** Owner decides when to kill its subscriptions.
* - Ownership is defined at creation of the [[Subscription]]
* - Ownership is non-transferable
* - There is no way to unkill a Subscription
* - In other words: Owner can only own a Subscription once,
* and a Subscription can only ever be owned by its initial owner
* - Owner can still be used after calling killPossessions, but the canonical
* use case is for the Owner to kill its possessions when the owner itself
* is discarded (e.g. a UI component is unmounted).
* - Ownership is defined at creation of the [[Subscription]]
* - Ownership is non-transferable
* - There is no way to unkill a Subscription
* - In other words: Owner can only own a Subscription once,
* and a Subscription can only ever be owned by its initial owner
* - Owner can still be used after calling killPossessions, but the canonical
* use case is for the Owner to kill its possessions when the owner itself
* is discarded (e.g. a UI component is unmounted).
*
* If you need something more flexible, use [[DynamicOwner]],
* or build your own custom logic on top of this in a similar manner.
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/com/raquo/airstream/state/Var.scala
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ object Var {
* Example usage: Var.update(var1 -> value1 => value1 + 1, var2 -> value2 => value2 * 2)
*
* Mod functions should be PURE.
* - If a mod throws, the var will be set to a failed state.
* - If you try to update a failed Var, `Var.update` will post an error to unhandled errors,
* and none of the Vars will update.
* - If a mod throws, the var will be set to a failed state.
* - If you try to update a failed Var, `Var.update` will post an error to unhandled errors,
* and none of the Vars will update.
*
* Reports an Airstream unhandled error:
* 1) if currentValue of any of the vars is a Failure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import scala.util.Try

/** Note: This is generally supposed to be used only with streams as inputs.
* Make sure you know what you're doing if using signals.
* - if `parent` is a Signal, this stream mirrors `parent.changes`, not `parent`.
* - if `after` is a Signal, this stream ignores its initial value
* - if `parent` is a Signal, this stream mirrors `parent.changes`, not `parent`.
* - if `after` is a Signal, this stream ignores its initial value
*/
class SyncDelayStream[A](
override protected[this] val parent: Observable[A],
Expand Down
14 changes: 7 additions & 7 deletions src/main/scala/com/raquo/airstream/timing/ThrottleStream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import scala.scalajs.js.timers.SetTimeoutHandle
import scala.util.Try

/** [[ThrottleStream]] 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.
* - 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 [[DebounceStream]]
*/
Expand Down
18 changes: 9 additions & 9 deletions src/main/scala/com/raquo/airstream/web/WebStorageVar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import scala.util.{Success, Try}
* and SessionStorage) in browser settings. In those cases, the
* Var will still work as a normal Airstream Var, but its value
* will not be persisted in the browser.
* - To detect this condition, see helpers on the companion object.
* - To detect this condition, see helpers on the companion object.
*
* See https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
* See https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
*
* For constructor params doc, see scaladoc for:
* - [[WebStorageVar.localStorage]]
* - [[WebStorageVar.sessionStorage]]
* - [[WebStorageVar.localStorage]]
* - [[WebStorageVar.sessionStorage]]
*/
class WebStorageVar[A] private[web] (
private[web] val maybeStorage: () => Option[dom.Storage],
Expand Down Expand Up @@ -224,24 +224,24 @@ object WebStorageVar {

/** Users may disable site data (incl. LocalStorage) in browser settings.
* This checks whether you can actually write to LocalStorage.
* - Note: If this returns false, Airstream's local storage Var would keep
* working as a regular Var, but without persistence to localStorage.
* - Note: If this returns false, Airstream's local storage Var would keep
* working as a regular Var, but without persistence to localStorage.
*
* See [[localStorageError]]
*/
def isLocalStorageAvailable(): Boolean = localStorageError().isEmpty

/** Users may disable site data (incl. SessionStorage) in browser settings.
* This checks whether you can actually write to SessionStorage.
* - Note: If this returns false, Airstream's session storage Var would keep
* working as a regular Var, but without persistence to sessionStorage.
* - Note: If this returns false, Airstream's session storage Var would keep
* working as a regular Var, but without persistence to sessionStorage.
*
* See [[sessionStorageError]]
*/
def isSessionStorageAvailable(): Boolean = sessionStorageError().isEmpty

/** If this method returns an error, you won't be able to save data to LocalStorage.
* - Note: the Airstream LocalStorage Var will continue working as an ephemeral Var.
* - Note: the Airstream LocalStorage Var will continue working as an ephemeral Var.
*
* See [[isLocalStorageAvailable]]
*/
Expand All @@ -250,7 +250,7 @@ object WebStorageVar {
}

/** If this method returns an error, you won't be able to save data to SessionStorage,
* - Note: the Airstream SessionStorage Var will continue working as an ephemeral Var.
* - Note: the Airstream SessionStorage Var will continue working as an ephemeral Var.
*
* See [[isSessionStorageAvailable]]
*/
Expand Down

0 comments on commit c3bc01d

Please sign in to comment.