Skip to content

Commit

Permalink
Change callback properties on stdlib event for better usability (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgonmic committed Aug 11, 2022
1 parent eeb72f4 commit 2000e13
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 126 deletions.
5 changes: 3 additions & 2 deletions buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ fun Appendable.facade(facade: AttributeFacade) {
}

fun Appendable.eventProperty(parent: String, attribute: AttributeInfo) {
val type = "(org.w3c.dom.events.Event) -> Unit"
variable(receiver = parent, variable = Var(
name = attribute.fieldName + "Function",
type = "(Event) -> Unit",
type = type,
mutable = true
))
emptyLine()
Expand All @@ -64,7 +65,7 @@ fun Appendable.eventProperty(parent: String, attribute: AttributeInfo) {
functionCall("onTagEvent", listOf(
"this",
attribute.name.quote(),
"newValue"
"newValue.unsafeCast<(Event) -> Unit>()"
))
}
emptyLine()
Expand Down
Loading

0 comments on commit 2000e13

Please sign in to comment.