examples: webview and async

This commit is contained in:
Jonathan Kelley committed 2021-07-08 23:25:27 -04:00
1 parent 99d94b69ab
commit eb82051000
13 files changed
+355 -57

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
# Suspense, Async, and More
This doc goes into the design of asynchronicity in Dioxus.
## for UI elements
`suspend`-ing a future submits an &mut future to Dioxus. the future must return VNodes. the future is still waiting before the component renders, the `.await` is dropped and tried again. users will want to attach their future to a hook so the future doesn't really get dropped.
## for tasks
for more general tasks, we need some way of submitting a future or task into some sort of task system.
`use_task()` submits a future to Dioxus. the future is polled infinitely until it finishes. The caller of `use_task` may drop, pause, restart, or insert a new the task
```rust
let task = use_hook(|| {
// create the future
}, || {
update the future if it needs to be updated
}, || {
});
cx.poll_future()
// let recoil_event_loop = cx.use_task(move |_| async move {
// loop {
// let msg = receiver.await?;
// }
// });
// where suspend wraps use_task
```
+18 -9
View File
@@ -1,14 +1,14 @@
- [] Move the builder API onto NodeFactory
- [] Transition away from names and towards compile-time safe tags
- [] Fix diffing of fragments
- [] Properly integrate memoization to prevent safety issues with children
- [] Understand and fix the issue with callbacks (outdated generations)
- [] Fix examples for core, web, ssr, and general
- [x] Move the builder API onto NodeFactory
- [x] Transition away from names and towards compile-time safe tags
- [x] Fix diffing of fragments
- [x] Properly integrate memoization to prevent safety issues with children
- [x] Understand and fix the issue with callbacks (outdated generations)
- [x] Fix examples for core, web, ssr, and general
- [] Finish up documentation
- [] Polish the Recoil (Dirac?) API
- [] Find better names for things
- [x] Find better names for things
- [] get the html macro up to parity with the rsx! macro
- [] put warnings in for iterating w/o keys
- [x] put warnings in for iterating w/o keys
- [] finish up the crate for generating code blocks
- [] make progress on the docusarus-style crate for generating the websites
- [] build the docsite
@@ -17,4 +17,13 @@
- [] Implement controlled inputs for select and textarea
- [] ...somehow... noderefs....
use_state(cx, )
- [x] soup of the use_state hook
- [ ] wire up inline css
- [ ] compile-time correct inline CSS
- [ ] signals
- [ ] cooperative scheduler
- [ ] suspense
- [ ] task system
- [] wire up events for webview
- [] JIT for class-based style engines
- []