commonMain.dev.programadorthi.routing.compose.ComposeResource.kt Maven / Gradle / Ivy
package dev.programadorthi.routing.compose
import dev.programadorthi.routing.core.application.ApplicationCall
import io.ktor.util.AttributeKey
private val ComposeRoutingResourceAttributeKey: AttributeKey =
AttributeKey("ComposeRoutingResourceAttributeKey")
@PublishedApi
internal var ApplicationCall.resource: Any?
get() = attributes.getOrNull(ComposeRoutingResourceAttributeKey)
set(value) {
if (value != null) {
attributes.put(ComposeRoutingResourceAttributeKey, value)
} else {
attributes.remove(ComposeRoutingResourceAttributeKey)
}
}
public inline fun ApplicationCall.resource(): T? =
when (resource) {
is T -> resource as T
else -> null
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy