mogwai
uses web-sys
and wasm_bindgen
to accomplish DOM creation and dynamic updates.
Mogwai's main type Gizmo<T>
has a type variable T
meant to be filled by web-sys
types
that represent DOM nodes. Since web-sys
's operations rely on javascript->wasm interop, any server side (ie rust only) pre-rendering should not happen through the normal browser-bound mogwai codepath. Of course using web-sys
in
this way would compile fine - but attempting to build the DOM and run a mogwai Gizmo when compiled to native code would cause a panic. Not all is lost though, as this actually points us in the direction of
a sane implementation so long as we don't get carried away.
mogwai
is meant to be a lightning fast frontent library, not a feature-rich web development framework. There
are already plenty of heavy frameworks (I'm looking at Yew, kid). To this end I don't want to push mogwai
into
becoming an "isomorphic" framework (ie one that can run the same code on both server and browser). Instead I would