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
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
Members list
Value members
Abstract methods
Modify the path(es) generated and parsed by this rule.
Modify the path(es) generated and parsed by this rule.
Value parameters
- onCreate
-
Modify paths when generating for a route.
- onParse
-
When parsing a path, transform and optionally reject it.
Attributes
Concrete methods
Prevent this rule from functioning unless some condition holds.
Prevent this rule from functioning unless some condition holds.
Value parameters
- condition
-
Sync[Unit] that requested page and returns true if the page should be rendered.
Attributes
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.
Value parameters
- condition
-
Function that takes the requested page and returns true if the page should be rendered.
Attributes
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, a fallback action is performed.
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, a fallback action is performed.
Value parameters
- condition
-
Sync[Unit] that requested page and returns true if the page should be rendered.
- fallback
-
Response when rule matches but condition doesn't hold.
Attributes
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.
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.
Value parameters
- 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.
Attributes
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, an optional fallback action may be performed.
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, an optional fallback action may be performed.
Value parameters
- condition
-
Sync[Unit] 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
None
it will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.
Attributes
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, an optional fallback action may be performed.
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, an optional fallback action may be performed.
Value parameters
- condition
-
Sync[Unit] 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
None
it will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.
Attributes
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.
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.
Value parameters
- 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
None
it will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.
Attributes
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.
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.
Value parameters
- 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
None
it will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.
Attributes
See autoCorrect.
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-23
and returns a Page("DEV", 23)
for which the generate path would be /issue/DEV-23
, this would automatically redirect /issue/dev-23
to /issue/DEV-23
, and process /issue/DEV-23
normally using its associated action.
Attributes
Specify behaviour when a Page
doesn't have an associated Path
or Action
.
Specify behaviour when a Page
doesn't have an associated Path
or Action
.
Attributes
When a Page
doesn't have an associated Path
or Action
, throw a runtime error.
When a Page
doesn't have an associated Path
or Action
, throw a runtime error.
This is the trade-off for keeping the parsing and generation of known Page
s in sync - compiler proof of Page
exhaustiveness is sacrificed.
It is recommended that you call RouterConfig.verify as a sanity-check.
Attributes
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.
Attributes
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.
Attributes
Compose rules.
Compose rules.