japgolly.scalajs.react.extra.router

Type members

Classlikes

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

An absolute URL.

An absolute URL.

Companion
object
object AbsUrl
Companion
class
sealed trait ActionF[+F[_], Page, -Props] extends Product with Serializable
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".

Companion
object
object BaseUrl
Companion
class
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.

Companion
object
object Path
Companion
class
abstract class PathLike[Self <: PathLike[Self]]
sealed trait Redirect[Page] extends ActionF[Nothing, Page, Any]
final case class RedirectToPage[Page](page: Page, via: SetRouteVia) extends Redirect[Page]
final case class RedirectToPath[Page](path: Path, via: SetRouteVia) extends Redirect[Page]
final case class RendererF[F[_], Page, -Props](render: RouterCtlF[F, Page] => Props => VdomElement)(implicit sync: Sync[F]) extends ActionF[F, Page, Props]
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 Params
page

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

render

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

sealed abstract class RouteCmd[A]
Companion
object
object RouteCmd
Companion
class
object Router
object RouterConfig
Companion
class
final class RouterConfigDsl[Page, Props]

DSL for creating RouterConfig.

DSL for creating RouterConfig.

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

Companion
object
abstract class RouterCtlF[F[_], Route]

Router controller. A client API to the router.

Router controller. A client API to the router.

Type Params
Route

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

Companion
object
object RouterCtlF
Companion
class
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 Params
Page

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

Value Params
baseUrl

The prefix of all routes in a set.

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])
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 Params
Page

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

Companion
object
object RoutingRule
Companion
class
object RoutingRules
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 Params
Page

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

Companion
object
Companion
class
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.

Companion
object
object SetRouteVia
Companion
class
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.

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 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 Params
Page

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

Value members

Concrete methods

@inline
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]