Package dev.fritz2.routing

Types

MapRoute
Link copied to clipboard
js
open class MapRoute(default: Map<String, String>) : Route<Map<String, String>>
MapRoute marshals and unmarshals a Map to and from window.location.
Route
Link copied to clipboard
js
interface Route<T>
A Route is a abstraction for routes which needed for routing
Router
Link copied to clipboard
js
class Router<T>(defaultRoute: Route<T>)
Router register the event-listener for hashchange-event and handles route-changes.
StringRoute
Link copied to clipboard
js
open class StringRoute(default: String) : Route<String>
StringRoute is a simple Route which marshals and unmarshalls nothing.

Functions

decodeURIComponent
Link copied to clipboard
js
external fun decodeURIComponent(encodedURI: String): String
encodeURIComponent
Link copied to clipboard
js
external fun encodeURIComponent(decodedURI: String): String
router
Link copied to clipboard
js
fun <T> router(default: Route<T>): Router<T>
Creates a new type based Router.
fun router(default: String): Router<String>
Creates a new simple String based Router
fun router(default: Map<String, String>): Router<Map<String, String>>
Creates a new Map based Router
select
Link copied to clipboard
js
fun Router<Map<String, String>>.select(key: String): Flow<Pair<String?, Map<String, String>>>
Selects with the given key a Pair of the value and all routing parameters as Map.
fun Router<Map<String, String>>.select(key: String, orElse: String): Flow<String>
Returns the value for the given key from the routing parameters.