(Sorry for the late reply) This is what I would li...
# javascript
l
(Sorry for the late reply) This is what I would like to achieve (I use props/state/class components but it should be the same):
🙏 2
r
Am I correct that
input
calls
attrs.onChangeFunction
?
l
yes
r
Probably you could do something like
Copy code
fun RBuilder.a(block: RDOMBuilder<INPUT>.() -> Unit) = input {
    apply(block)
    val existed = attrs.onChangeFunction
    attrs.onChangeFunction = {
       println("Hello A")
       existed()
    }
}
l
Copy code
cause_th0jdv$_0: null
message_8yp7un$_0: "You can't read variable onChange"
name: "UnsupportedOperationException"
😔
r
Oops, which React bindings do you use?
l
You mean which wrappers? If so:
Copy code
'org.jetbrains:kotlin-react:16.6.0-pre.70-kotlin-1.3.21'
'org.jetbrains:kotlin-react-dom:16.6.0-pre.70-kotlin-1.3.21'
🙏 1
r
Seems like an issue in kotlinx.html. Will ask relevant person and let you know
l
Alright, thanks!
r
What is kotlin type of
attrs.onChangeFunction
?
l
Copy code
var CommonAttributeGroupFacade.onChangeFunction : (Event) -> Unit
    get()  = throw UnsupportedOperationException("You can't read variable onChange")
    set(newValue) {consumer.onTagEvent(this, "onchange", newValue)}
r
Folks from kotlinx.html say that currently there is no solution other than save original lambda somewhere and re-use it when needed. What else I would suggest is try using dynamic like this
attrs.asDynamic().onChange
l
Alright, I'll try out both solutions soon, thanks a lot for the help!