So, I've got a question again about the compose-we...
# compose-web
a
So, I've got a question again about the compose-web. I am just browsing the internals to learn from. At this moment I have reached the
ComposeDomNode
Composable (https://github.com/JetBrains/compose-jb/blob/master/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/elements/Base.kt) which look to be at the center of all of it. I have a few questions related to the compose-web part: 1. The
DomNodeWrapper
handles the insertion and deletion of actual DOM nodes, triggered by the
DomApplier
. Correct? 2. The
ComposeDomNode
really ties into the internals of the composer. Is this because DOM recomposition requires only updating DOM elements and/or inserting/deleting them, instead of the clear-screen-redraw-routine of canvas/skia based rendering? 3. In the Applier I see (just like in Jake Whartons Mosaic demo) that they always assume the tree is built bottom-up. How is this known / enforced?
h
o
1. yes 2. I would say ComposeDomNode is not really about DOM (except the naming). In androidx compose there is ComposeNode and it's quite similar. ComposeDomNode was created to support the scoped content (
TScope
), otherwise, I think ComposeNode would fit as well. 3. It's enforced by Applier implementation https://github.com/JetBrains/compose-jb/blob/master/web/internal-web-core-runtime/[…]kotlin/org/jetbrains/compose/web/internal/runtime/DomApplier.kt
a
Hmm, maybe I am confused. I thought the DomApplier is called from somewhere else. Just because it doesn't implement a method, how is it then enforced?
o
both methods get invoked here. Since only one of them is implemented in actual applier, then an element gets inserted only once either in topDown or bottomUp way. Here is some doc about applier
a
Thanks, I was confused. You can decide yourself, as Applier implementor, if you choose bottom-up or top-down but both of them are called always. I thought that it was required to implement the whole interface.