MapRoute

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 ?.

Parameters

default

Map to use when no explicit window.location.hash was set before

Constructors

Link copied to clipboard
constructor(default: Map<String, String> = emptyMap())

Properties

Link copied to clipboard
open override val default: Map<String, String>

Functions

Link copied to clipboard
open override fun deserialize(hash: String): Map<String, String>

Deserializes the window.location.hash to the given type T after the hashchange-event is fired.

Link copied to clipboard
open override fun serialize(route: Map<String, String>): String

Serializes a given object of type T to String for setting it to the window.location.hash