Now that rust can compile using emscripten, does anyone fancy helping to make a VDOM (virtual DOM) lib. Here’s how it works (ish):
After every change, a new object representing the next DOM state is passed to our runtime. Our runtime is then responsible for comparing this new state with our current state and computing the minimal list of changes to convert the old to the new. This list is then run on the DOM to update it to the new state (see this diagram for a visual representation).
Using this method allows for much faster webapps than replacing the whole DOM (DOM operations are expensive), and it promotes declarative styles of UI design, leading to much more maintainable code, as there are less hidden links between different parts of the DOM. I’ve just had first hand experience of this working with some React code I wrote a few years ago. I can’t remember writing it, but I can figure out how it works pretty easily by tracking how the data flows from the root down into all the components.
I believe this is how Conrod works, so maybe ideas (or even code) could be borrowed.
Anyone interested? It’s graph theory (= fun!) and I don’t really have a clue so could do with some help