pub async fn render_loop<N, E, S, P>(
root: Arc<N>,
element: Element<N, E>,
spawner: S,
object_model: P,
) -> Result<(), E>
Expand description
render_loop can be used to implement interactive renderers on top of bloom-core. The primary renderer is the bloom-client library which implements client side rendering in the browser on top of bloom using webassembly. The root is the root node in the host environment which will contain the rendered UI. In web-environments the root might be a div within the body that is part of the server-sent html:
<html>
<body>
<div id="root"></div>
</body>
</html>
render_loop(get_element_by_id('root'), ...)
The element is the root of the component tree that represents the intended UI. This is usually a component:
render_loop(root_node, rsx!(<MyComponent />), ...)
The spawner-argument is an object that implements the Spawn-trait so bloom can spawn async tasts on arbitrary task runners such as tokio or async-std.
The object model is the interface to the host environment.