Package-level declarations

Types

Link copied to clipboard
open class MapRoute(val default: Map<String, String> = emptyMap()) : Route<Map<String, String>>

MapRoute serializes and deserializes a Map to and from window.location.hash. It is like using url parameters with pairs of key and value. At the start of the route is only a # instead of ?.

Link copied to clipboard
open class MapRouter(defaultRoute: Map<String, String> = emptyMap(), job: Job) : Router<Map<String, String>>

Represents the current Route as Map of Strings.

Link copied to clipboard
interface Route<T>

A Route is an abstraction for routes which needed for routing

Link copied to clipboard
open class Router<T>(defaultRoute: Route<T>, val job: Job) : Store<T>

Router register the event-listener for hashchange-event and handles route-changes. Therefore, it uses a Route object which can Route.serialize and Route.deserialize the given type.

Link copied to clipboard
open class StringRoute(val default: String = "") : Route<String>

StringRoute is a simple Route which serializes and deserializes nothing.

Functions

Link copied to clipboard
external fun decodeURIComponent(encodedURI: String): String
Link copied to clipboard
external fun encodeURIComponent(decodedURI: String): String
Link copied to clipboard
fun <T> routerOf(default: Route<T>, job: Job = Job()): Router<T>

Creates a new type based Router. Therefore, the given type must implement the Route interface.

fun routerOf(default: String = "", job: Job = Job()): Router<String>

Creates a new simple String based Router

fun routerOf(default: Map<String, String> = emptyMap(), job: Job = Job()): MapRouter

Creates a new Map based Router