mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-12-25 12:03:08 +00:00
904b26f711
This commit adds a new type - the DomEdit - for serializing the changes made by the diffing machine. The architecture of how DomEdits fit into the cooperative scheduling is still TBD but it will allow us to build change lists without applying them immediately. This is more performant and allows us to only render parts of the page at a time. This commit also adds more infrastructure around webview. Dioxus can now run on the web, generate static pages, run in the desktop, and run on mobile, with a large part of thanks to webview.
28 lines
760 B
Rust
28 lines
760 B
Rust
//! An example where the dioxus vdom is running in a native thread, interacting with webview
|
|
//! Content is passed from the native thread into the webview
|
|
use dioxus_core as dioxus;
|
|
use dioxus_core::prelude::*;
|
|
fn main() {
|
|
dioxus_webview::launch(
|
|
|builder| {
|
|
builder
|
|
.title("Test Dioxus App")
|
|
.size(320, 480)
|
|
.resizable(false)
|
|
.debug(true)
|
|
},
|
|
(),
|
|
App,
|
|
)
|
|
.expect("Webview finished");
|
|
}
|
|
|
|
static App: FC<()> = |cx| {
|
|
let hifives = use_model(&cx, || 0);
|
|
cx.render(rsx! {
|
|
div {
|
|
h1 { "Hi-fives collected: {hifives}" }
|
|
button { "Hi five me!", onclick: move |_| *hifives.get_mut() += 1 }
|
|
}
|
|
})
|
|
};
|