commonMain.app.softwork.routingcompose.DelegateRouter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of routing-compose Show documentation
Show all versions of routing-compose Show documentation
A multiplatform library for routing to use with JetPack Compose Web and Desktop
package app.softwork.routingcompose
internal class DelegateRouter(val basePath: String, val router: Router) : Router by router {
override fun navigate(to: String, hide: Boolean) {
when {
to.startsWith("/") -> {
router.navigate(to, hide)
}
basePath == "/" -> {
router.navigate("/$to", hide)
}
to.startsWith(".") -> {
val newPath = router.currentPath.relative(to)
router.navigate(newPath.path)
}
else -> {
router.navigate("$basePath/$to", hide)
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy