hexops / vecty

Vecty lets you build responsive and dynamic web frontends in Go using WebAssembly, competing with modern web frameworks like React & VueJS.
BSD 3-Clause "New" or "Revised" License
2.8k stars 143 forks source link

Add support for rendering into non-body DOM nodes #249

Closed slimsag closed 4 years ago

slimsag commented 4 years ago

This PR adds support for rendering into arbitrary DOM nodes in the same way that rendering into the body worked previously, with one exception: blocking.

RenderBody remains blocking, since it effectively becomes a helper that 90% of Vecty applications will rely on, whereas RenderInto and RenderIntoNode which are introduced in this PR do not block. This is because:

a. Anyone rendering Vecty into arbitrary DOM nodes will likely want to do it more than once, so making the API of these functions non-blocking makes sense. b. Anyone using these functions will be a more advanced user and understand when blocking is / is not needed.

In order to land this PR earlier for users who need this functionality, tests will not be added for the new functionality. They will be added in a follow-up as part of #168.

Fixes #81 Fixes #247