How do yall deal with multiple levels of subcompon...
# javascript
g
How do yall deal with multiple levels of subcomponents, each with their own controllers, styles, view, other, etc? Specifically in relation to the controllers though. Since we are talking KJS, it seems like you have to appendChild the view AND THEN run the controller code to addEventListener too it. But that doesn't appear simple when things are nested, the lower level groups seem to fail. Does this make sense? For Example:
Copy code
class master(body: Element) {
    val master = document.create.div("d-block") { 
          childObject()
         +"MasterView" 
    )
    init {
         body.appendChild(editor)
         masterController()
    }
}

class childObject(body: Element) {
    val child= document.create.div("d-block") { 
          childObject()
         +"ChildView" 
    )
    init {
         body.appendChild(editor)
         childController()
    }
}
SOLVED: don't nest children, they are intended to be a brothers not children... also give the child/brothers the parent to attach it's children too.. lol, man that sounds bad... sounds like, some serious mutant incest going on in the world of Kotlin today... shes my sister, shes my daughter, shes my sister, she's my daughter... lol, no one is going to get that joke. Anyway, solution:
Copy code
class master(body: Element) {
    val master = document.create.div("d-block") { 
         +"MasterView" 
    )
    init {
         childObject(body)
         body.appendChild(editor)
         masterController()
    }
}
Don't give children the body, lol.
Any other tips appreciated for prettier code