Feat: add webview example

This commit is contained in:
Jonathan Kelley committed 2021-01-22 15:50:16 -05:00
1 parent 7730fd4a8c
commit 65d0d611ea
11 files changed
+84 -38

No files matched your search

+1
View File
@@ -10,3 +10,4 @@ description = "Core functionality for Dioxus - a concurrent renderer-agnostic Vi
[dependencies]
dioxus-core = { path = "../core", version = "0.1.0" }
dioxus-core-macro = { path = "../core-macro", version = "0.1.0" }
dioxus-hooks = { path = "../hooks", version = "0.0.0" }
+1
View File
@@ -1,6 +1,7 @@
pub mod prelude {
pub use dioxus_core::prelude::*;
pub use dioxus_core_macro::fc;
pub use dioxus_hooks::prelude::use_state;
}
use dioxus_core::prelude::FC;
+2 -1
View File
@@ -6,4 +6,5 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
[dependencies]
dioxus-core = { path = "../core" }
+5 -5
View File
@@ -1,7 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
pub mod prelude {
use dioxus_core::prelude::Context;
pub fn use_state<T, G>(ctx: &mut Context<G>, init: impl Fn() -> T) -> (T, impl Fn(T)) {
let g = init();
(g, |_| {})
}
}
+35 -5
View File
@@ -1,7 +1,37 @@
#[cfg(test)]
pub struct Store<T> {
user_data: T,
}
/// Select just a small bit of the
fn use_selector() {}
/*
// borrow a closure so we can copy the reference
let dispatch = use_dispatch::<UserData>(ctx);
dispatch(|| UserData::Logout)
dispatch()
*/
fn use_dispatch() {}
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
struct UserData {}
// static SelectLoggedIn: FC<T> = |_| {};
/*
// Merge the various stores into a single context
// This auto generates the appropriate selectors, reducing the need to wrap the app in excess providers
let all = combine_stores(vec![store1, store2]);
<Redux store={all}>
</Redux>
*/
}
+1 -1
View File
@@ -37,7 +37,7 @@ impl<T> WebviewRenderer<T> {
todo!()
}
pub async fn launch(self, props: T) {
pub fn launch(self, props: T) {
let mut ctx = Context { props: &props };
let WebviewRenderer { root } = self;
let content = root(&mut ctx);