japgolly.scalajs.react.extra.router

Members list

Type members

Classlikes

final case class AbsUrl(value: String) extends PathLike[AbsUrl]

An absolute URL.

An absolute URL.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class PathLike[AbsUrl]
class Object
trait Matchable
class Any
Show all
object AbsUrl

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
AbsUrl.type
sealed trait ActionF[+F[_], Page, -Props] extends Product, Serializable

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Redirect[Page]
class RedirectToPage[Page]
class RedirectToPath[Page]
class RendererF[F, Page, Props]
final case class BaseUrl(value: String) extends PathLike[BaseUrl]

The prefix of all routes on a page.

The prefix of all routes on a page.

The router expects this to be a full URL. Examples: BaseUrl("http://www.blah.com/hello"), BaseUrl.fromWindowOrigin / "hello".

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class PathLike[BaseUrl]
class Object
trait Matchable
class Any
Show all
object BaseUrl

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
BaseUrl.type
final case class Path(value: String) extends PathLike[Path]

The portion of the URL after the BaseUrl.

The portion of the URL after the BaseUrl.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class PathLike[Path]
class Object
trait Matchable
class Any
Show all
object Path

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Path.type
abstract class PathLike[Self <: PathLike[Self]]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class AbsUrl
class BaseUrl
class Path
Self type
Self
sealed trait Redirect[Page] extends ActionF[Nothing, Page, Any]

Attributes

Supertypes
trait ActionF[Nothing, Page, Any]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class RedirectToPage[Page]
class RedirectToPath[Page]
final case class RedirectToPage[Page](page: Page, via: SetRouteVia) extends Redirect[Page]

Attributes

Supertypes
trait Redirect[Page]
trait ActionF[Nothing, Page, Any]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class RedirectToPath[Page](path: Path, via: SetRouteVia) extends Redirect[Page]

Attributes

Supertypes
trait Redirect[Page]
trait ActionF[Nothing, Page, Any]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class RendererF[F[_], Page, -Props](render: RouterCtlF[F, Page] => Props => VdomElement)(implicit sync: Sync[F]) extends ActionF[F, Page, Props]

Attributes

Supertypes
trait ActionF[F, Page, Props]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class ResolutionWithProps[P, Props](page: P, renderP: Props => VdomElement)

Result of the router resolving a URL and reaching a conclusion about what to render.

Result of the router resolving a URL and reaching a conclusion about what to render.

Value parameters

page

Data representation (or command) of what will be drawn.

render

The render function provided by the rules and logic in RouterConfig.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed abstract class RouteCmd[A]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object BroadcastSync.type
class Log
class PushState
class ReplaceState
class Return[A]
class Sequence[A]
Show all
object RouteCmd

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
RouteCmd.type
object Router

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Router.type
object RouterConfig

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class RouterConfigDsl[Page, Props]

DSL for creating RouterConfig.

DSL for creating RouterConfig.

Instead creating an instance of this yourself, use RouterConfigDsl.apply.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
abstract class RouterCtlF[F[_], Route]

Router controller. A client API to the router.

Router controller. A client API to the router.

Type parameters

Route

A data type that indicates a route that can be navigated to.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class AltEffect[F, G, A]
class Contramap[F, A, B]
class ModCB[F, A]
object RouterCtlF

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
RouterCtlF.type
final class RouterLogicF[F[_], Page, Props](val baseUrl: BaseUrl, cfg: RouterWithPropsConfigF[F, Page, Props]) extends BroadcasterF[F, Unit]

Performs all routing logic.

Performs all routing logic.

Type parameters

Page

Routing rules context. Prevents different routing rule sets being mixed up.

Value parameters

baseUrl

The prefix of all routes in a set.

Attributes

Supertypes
trait BroadcasterF[F, Unit]
trait ListenableF[F, Unit]
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class RouterWithPropsConfigF[F[_], Page, Props](rules: RoutingRulesF[F, Page, Props], renderFn: (RouterCtlF[F, Page], ResolutionWithProps[Page, Props]) => Props => VdomElement, postRenderFn: (Option[Page], Page, Props) => F[Unit], logger: Logger)(implicit effect: Sync[F])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
RouterWithPropsConfigF[F, Page, Props]
sealed trait RoutingRule[Page, Props]

A single routing rule. Intended to be composed with other RoutingRules. When all rules are composed, this is turned into a RoutingRule.WithFallback instance.

A single routing rule. Intended to be composed with other RoutingRules. When all rules are composed, this is turned into a RoutingRule.WithFallback instance.

Type parameters

Page

The type of legal pages. Most commonly, a sealed trait that you've created, where all subclasses represent a page in your SPA.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Atom[Page, Props]
class AutoCorrect[Page, Props]
class Conditional[Page, Props]
class ConditionalP[Page, Props]
class Or[Page, Props]
object RoutingRule

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
object RoutingRules

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class RoutingRulesF[F[_], Page, Props](parseMulti: Path => List[StaticOrDynamic[Option[Parsed[Page]]]], path: Page => Path, actionMulti: (Path, Page) => List[StaticOrDynamic[Option[ActionF[F, Page, Props]]]], fallbackAction: (Path, Page) => ActionF[F, Page, Props], whenNotFound: Path => F[Parsed[Page]])(implicit F: Sync[F])

A complete set of routing rules that allow the router to handle every all routes without further input.

A complete set of routing rules that allow the router to handle every all routes without further input.

Type parameters

Page

The type of legal pages. Most commonly, a sealed trait that you've created, where all subclasses represent a page in your SPA.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object RoutingRulesF

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait SetRouteVia

The means by which the location should be set to a given URL.

The means by which the location should be set to a given URL.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object HistoryPush.type
object HistoryReplace.type
object WindowLocation.type
object SetRouteVia

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
object StaticDsl

This is not meant to be imported by library-users; RouterConfigDsl is the entire library-user-facing facade & DSL.

This is not meant to be imported by library-users; RouterConfigDsl is the entire library-user-facing facade & DSL.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
StaticDsl.type

Types

type Action[Page, -Props] = ActionF[Sync, Page, Props]
type Renderer[Page, -Props] = RendererF[Sync, Page, Props]
type Resolution[P] = ResolutionWithProps[P, Unit]
type Router[P] = RouterF[Sync, P]
type RouterConfig[P] = RouterWithPropsConfig[P, Unit]
type RouterCtl[A] = RouterCtlF[Sync, A]
type RouterF[F[_], P] = Component[Unit, Resolution[P], OnUnmountF[F], Nullary]
type RouterFM[F[_], P] = MountedImpure[Unit, Resolution[P], OnUnmountF[F]]
type RouterFU[F[_], P] = Unmounted[Unit, Resolution[P], OnUnmountF[F]]
type RouterLogic[Page, Props] = RouterLogicF[Sync, Page, Props]
type RouterM[P] = RouterFM[Sync, P]
type RouterU[P] = RouterFU[Sync, P]
type RouterWithProps[P, Props] = RouterWithPropsF[Sync, P, Props]
type RouterWithPropsConfig[Page, Props] = RouterWithPropsConfigF[Sync, Page, Props]
type RouterWithPropsF[F[_], P, Props] = Component[Props, ResolutionWithProps[P, Props], OnUnmountF[F], Props]
type RouterWithPropsFM[F[_], P, Props] = MountedImpure[Props, ResolutionWithProps[P, Props], OnUnmountF[F]]
type RouterWithPropsFU[F[_], P, Props] = Unmounted[Props, ResolutionWithProps[P, Props], OnUnmountF[F]]
type RouterWithPropsM[P, Props] = RouterWithPropsFM[Sync, P, Props]
type RouterWithPropsU[P, Props] = RouterWithPropsFU[Sync, P, Props]
type RoutingRules[Page, Props] = RoutingRulesF[Sync, Page, Props]

A complete set of routing rules that allow the router to handle every all routes without further input.

A complete set of routing rules that allow the router to handle every all routes without further input.

Type parameters

Page

The type of legal pages. Most commonly, a sealed trait that you've created, where all subclasses represent a page in your SPA.

Attributes

Value members

Concrete methods

def RouterWithPropsConfig[Page, Props](rules: RoutingRules[Page, Props], renderFn: (RouterCtl[Page], ResolutionWithProps[Page, Props]) => Props => VdomElement, postRenderFn: (Option[Page], Page, Props) => Function0[Unit], logger: Logger): RouterWithPropsConfig[Page, Props]