Skip to content

Commit

Permalink
Custom event handler param for event function
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed Nov 11, 2023
1 parent 377126b commit 7be824a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import io.github.oshai.kotlinlogging.KotlinLogging
* @param body Builder lambda used for setting up the event handler object.
*/
public suspend inline fun <reified T : Event> Extension.event(
noinline constructor: (Extension) -> EventHandler<T> = ::EventHandler,
noinline body: suspend EventHandler<T>.() -> Unit
): EventHandler<T> {
val eventHandler = EventHandler<T>(this)
val eventHandler = constructor(this)
val logger = KotlinLogging.logger {}

body.invoke(eventHandler)
Expand Down

0 comments on commit 7be824a

Please sign in to comment.