sealed trait RoutingRule[Page, Props] extends AnyRef
A single routing rule. Intended to be composed with other RoutingRules. When all rules are composed, this is turned into a RoutingRule.WithFallback instance.
- Page
The type of legal pages. Most commonly, a sealed trait that you've created, where all subclasses represent a page in your SPA.
- Alphabetic
- By Inheritance
- RoutingRule
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
modPath(onCreate: (Path) ⇒ Path, onParse: (Path) ⇒ Option[Path]): RoutingRule[Page, Props]
Modify the path(es) generated and parsed by this rule.
Modify the path(es) generated and parsed by this rule.
- onCreate
Modify paths when generating for a route.
- onParse
When parsing a path, transform and optionally reject it.
- abstract def pmapF[W](f: (Page) ⇒ W)(g: (W) ⇒ Option[Page]): RoutingRule[W, Props]
- abstract def xmap[A](f: (Page) ⇒ A)(g: (A) ⇒ Page): RoutingRule[A, Props]
Concrete 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
-
final
def
addCondition(condition: (Page) ⇒ CallbackTo[Boolean]): RoutingRule[Page, Props]
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context.
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context.
- condition
Function that takes the requested page and returns true if the page should be rendered.
-
final
def
addCondition(condition: CallbackTo[Boolean]): RoutingRule[Page, Props]
Prevent this rule from functioning unless some condition holds.
Prevent this rule from functioning unless some condition holds.
- condition
Callback that requested page and returns true if the page should be rendered.
-
final
def
addConditionWithFallback(condition: (Page) ⇒ CallbackTo[Boolean], fallback: Action[Page]): RoutingRule[Page, Props]
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context.
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context. When the condition doesn't hold, a fallback action is performed.
- condition
Function that takes the requested page and returns true if the page should be rendered.
- fallback
Response when rule matches but condition doesn't hold.
-
final
def
addConditionWithFallback(condition: CallbackTo[Boolean], fallback: Action[Page]): RoutingRule[Page, Props]
Prevent this rule from functioning unless some condition holds.
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, a fallback action is performed.
- condition
Callback that requested page and returns true if the page should be rendered.
- fallback
Response when rule matches but condition doesn't hold.
-
final
def
addConditionWithOptionalFallback(condition: (Page) ⇒ CallbackTo[Boolean], fallback: Option[Action[Page]]): RoutingRule[Page, Props]
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context.
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context. When the condition doesn't hold, an optional fallback action may be performed.
- condition
Function that takes the requested page and returns true if the page should be rendered.
- fallback
Response when rule matches but condition doesn't hold. If response is
Noneit will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.
-
final
def
addConditionWithOptionalFallback(condition: CallbackTo[Boolean], fallback: Option[Action[Page]]): RoutingRule[Page, Props]
Prevent this rule from functioning unless some condition holds.
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, an optional fallback action may be performed.
- condition
Callback that requested page and returns true if the page should be rendered.
- fallback
Response when rule matches but condition doesn't hold. If response is
Noneit will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.
-
final
def
addConditionWithOptionalFallback(condition: (Page) ⇒ CallbackTo[Boolean], fallback: (Page) ⇒ Option[Action[Page]]): RoutingRule[Page, Props]
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context.
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context. When the condition doesn't hold, an optional fallback action may be performed.
- condition
Function that takes the requested page and returns true if the page should be rendered.
- fallback
Response when rule matches but condition doesn't hold. If response is
Noneit will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.
-
final
def
addConditionWithOptionalFallback(condition: CallbackTo[Boolean], fallback: (Page) ⇒ Option[Action[Page]]): RoutingRule[Page, Props]
Prevent this rule from functioning unless some condition holds.
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, an optional fallback action may be performed.
- condition
Callback that requested page and returns true if the page should be rendered.
- fallback
Response when rule matches but condition doesn't hold. If response is
Noneit will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
autoCorrect(redirectVia: SetRouteVia): RoutingRule[Page, Props]
When a route matches a page, compare its Path to what the route would generate for the same page and if they differ, redirect to the generated one.
When a route matches a page, compare its Path to what the route would generate for the same page and if they differ, redirect to the generated one.
Example: If a route matches
/issue/dev-23and returns aPage("DEV", 23)for which the generate path would be/issue/DEV-23, this would automatically redirect/issue/dev-23to/issue/DEV-23, and process/issue/DEV-23normally using its associated action. -
final
def
autoCorrect: RoutingRule[Page, Props]
See autoCorrect().
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
fallback(fallbackPath: (Page) ⇒ Path, fallbackAction: (Path, Page) ⇒ Action[Page]): WithFallback[Page, Props]
Specify behaviour when a
Pagedoesn't have an associatedPathorAction. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
noFallback: WithFallback[Page, Props]
When a
Pagedoesn't have an associatedPathorAction, throw a runtime error.When a
Pagedoesn't have an associatedPathorAction, throw a runtime error.This is the trade-off for keeping the parsing and generation of known
Pages in sync - compiler proof ofPageexhaustiveness is sacrificed.It is recommended that you call RouterConfig.verify as a sanity-check.
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def pmap[W](f: (Page) ⇒ W)(pf: PartialFunction[W, Page]): RoutingRule[W, Props]
- final def pmapCT[W](f: (Page) ⇒ W)(implicit ct: ClassTag[Page]): RoutingRule[W, Props]
-
final
def
prefixPath(prefix: String): RoutingRule[Page, Props]
Add a prefix to the path(es) generated and parsed by this rule.
-
final
def
prefixPath_/(prefix: String): RoutingRule[Page, Props]
Add a prefix to the path(es) generated and parsed by this rule.
Add a prefix to the path(es) generated and parsed by this rule.
Unlike prefixPath() when the suffix is non-empty, a slash is added between prefix and suffix.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- final def widen[W >: Page](pf: PartialFunction[W, Page]): RoutingRule[W, Props]
- final def widenCT[W >: Page](implicit ct: ClassTag[Page]): RoutingRule[W, Props]
- final def widenF[W >: Page](f: (W) ⇒ Option[Page]): RoutingRule[W, Props]
-
final
def
|(that: RoutingRule[Page, Props]): RoutingRule[Page, Props]
Compose rules.
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.