Macro widget

Source
macro_rules! widget {
    ($widget_label:expr, $create_widget_func:ident) => { ... };
}
Expand description

A macro for writing a process that serves a widget and completes. This process should be identified in your package manifest.json with on_exit set to None.

Make sure the process has requested capability to message homepage:homepage:sys!

Example:

wit_bindgen::generate!({
    path: "target/wit",
    world: "process-v0",
});

hyperware_process_lib::widget!("My widget", create_widget);

fn create_widget() -> String {
    return r#"<html>
        <head>
            <meta name="viewport" content="width=device-width, initial-scale=1">
            <link rel="stylesheet" href="/hyperware.css">
        </head>
        <body>
            <h1>Hello World!</h1>
        </body>
    </html>"#.to_string();
}