Skip to content

Commit

Permalink
New: mapToUnit; some Airstream aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
raquo committed Oct 1, 2022
1 parent 05e4447 commit caa0448
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/scala/com/raquo/laminar/api/Airstream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,24 @@ trait Airstream {

val DynamicSubscription: airstream.ownership.DynamicSubscription.type = airstream.ownership.DynamicSubscription

// -- Special streams

lazy val AjaxStream: airstream.web.AjaxStream.type = airstream.web.AjaxStream

lazy val FetchStream: airstream.web.FetchStream.type = airstream.web.FetchStream

// -- Flatten

type FlattenStrategy[-Outer[+_] <: Observable[_], -Inner[_], Output[+_] <: Observable[_]] = airstream.flatten.FlattenStrategy[Outer, Inner, Output]

lazy val SwitchStreamStrategy: airstream.flatten.FlattenStrategy.SwitchStreamStrategy.type = airstream.flatten.FlattenStrategy.SwitchStreamStrategy

lazy val ConcurrentStreamStrategy: airstream.flatten.FlattenStrategy.ConcurrentStreamStrategy.type = airstream.flatten.FlattenStrategy.ConcurrentStreamStrategy

lazy val SwitchSignalStreamStrategy: airstream.flatten.FlattenStrategy.SwitchSignalStreamStrategy.type = airstream.flatten.FlattenStrategy.SwitchSignalStreamStrategy

lazy val SwitchSignalStrategy: airstream.flatten.FlattenStrategy.SwitchSignalStrategy.type = airstream.flatten.FlattenStrategy.SwitchSignalStrategy

lazy val SwitchSignalObservableStrategy: airstream.flatten.FlattenStrategy.SwitchSignalObservableStrategy.type = airstream.flatten.FlattenStrategy.SwitchSignalObservableStrategy

}
2 changes: 2 additions & 0 deletions src/main/scala/com/raquo/laminar/keys/EventProcessor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class EventProcessor[Ev <: dom.Event, V](
withNewProcessor(ev => processor(ev).map(_ => value))
}

def mapToUnit: EventProcessor[Ev, Unit] = mapToStrict(())

/** Get the original event. You might want to call this in a chain, after some other processing. */
def mapToEvent: EventProcessor[Ev, Ev] = {
withNewProcessor(ev => processor(ev).map(_ => ev))
Expand Down

0 comments on commit caa0448

Please sign in to comment.