commonMain.dev.programadorthi.routing.events.resources.EventResources.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of events-resources Show documentation
Show all versions of events-resources Show documentation
A type-safe event support to events module
The newest version!
package dev.programadorthi.routing.events.resources
import dev.programadorthi.routing.core.application.Application
import dev.programadorthi.routing.core.application.BaseApplicationPlugin
import io.ktor.util.AttributeKey
/**
* Adds support for type-safe event using [EventResourcesConfiguration].
*
* Example:
* ```kotlin
* @Event("event_name")
* class DoSomething
*
* routing {
* event { doSomething ->
* // handle the event
* }
* }
* ```
*/
public object EventResources :
BaseApplicationPlugin {
override val key: AttributeKey = AttributeKey("EventResources")
override fun install(
pipeline: Application,
configure: EventResourcesConfiguration.Configuration.() -> Unit,
): EventResourcesConfiguration {
val configuration = EventResourcesConfiguration.Configuration().apply(configure)
return EventResourcesConfiguration(configuration)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy