Skip to content

Commit

Permalink
Merge branch 'master' into revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
DogeDark authored Jun 4, 2024
2 parents e6766e0 + d49812f commit dd09456
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
7 changes: 2 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"rust-analyzer.cargo.features": [
"desktop-testing"
"wasm-testing"
],
"rust-analyzer.cargo.extraArgs": [
"--exclude=color_scheme"
],
//"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
}
14 changes: 11 additions & 3 deletions examples/storage/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# use_persistent (Desktop)
# use_persistent


Use persistent allows you to create data that will persist across sessions. This example will teach you how to use the `use_persistant` hook.

Run:
Desktop:

```dioxus serve --platform desktop```
```sh
dioxus serve --platform desktop --features desktop
```

Web:

```sh
dioxus serve --features web
```
9 changes: 5 additions & 4 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ dioxus-signals = { version = "0.5.1", features = [
yazi = { version = "0.1.4", optional = true }
tracing = "0.1.40"

# Used by: timing
gloo-timers = { version = "0.3.0", optional = true }

# Used by: timing & storage
tokio = { version = "1.33.0", optional = true }

Expand Down Expand Up @@ -194,7 +191,11 @@ js-sys = "0.3.62"
# Used by: channel
uuid = { version = "1.3.2", features = ["js"] }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
# Used by: timing
gloo-timers = { version = "0.3.0", optional = true, features = ["futures"] }

[target.'cfg(not(target_family = "wasm32"))'.dependencies]

# Used by: storage
directories = { version = "4.0.1", optional = true }

Expand Down
5 changes: 5 additions & 0 deletions sdk/src/utils/timing/debounce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ pub fn use_debounce<T>(time: Duration, cb: impl FnOnce(T) + Copy + 'static) -> U
}

current_task = Some(spawn(async move {
#[cfg(not(target_family = "wasm"))]
tokio::time::sleep(time).await;

#[cfg(target_family = "wasm")]
gloo_timers::future::sleep(time).await;

cb(data);
}));
}
Expand Down

0 comments on commit dd09456

Please sign in to comment.