Skip to content

Commit 38130bf

Browse files
authored
Merge pull request #38 from Aehmlo/future-gate
Split up callback and future/stream APIs.
2 parents 4636c9a + 105043f commit 38130bf

File tree

5 files changed

+418
-373
lines changed

5 files changed

+418
-373
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ version = "0.1.0"
1111
gloo-timers = { version = "0.1.0", path = "crates/timers" }
1212
gloo-console-timer = { version = "0.1.0", path = "crates/console-timer" }
1313

14+
[features]
15+
default = []
16+
futures = ["gloo-timers/futures"]
17+
1418
[workspace]

crates/console-timer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The measurement ends when the timer object goes out of scope / is dropped.
3434
3535
```no_run
3636
use gloo_console_timer::ConsoleTimer;
37-
use gloo_timers::Timeout;
37+
use gloo_timers::callback::Timeout;
3838
3939
// Start timing a new operation.
4040
let timer = ConsoleTimer::new("foo");

crates/timers/Cargo.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,28 @@ authors = ["Rust and WebAssembly Working Group"]
55
edition = "2018"
66

77
[dependencies]
8-
wasm-bindgen-futures = "0.3.14"
98
wasm-bindgen = "0.2.37"
109
js-sys = "0.3.14"
11-
futures = "0.1.25"
10+
11+
[dependencies.futures_rs]
12+
package = "futures"
13+
version = "0.1.25"
14+
optional = true
15+
16+
[dependencies.wasm-bindgen-futures]
17+
version = "0.3.14"
18+
optional = true
1219

1320
[dependencies.web-sys]
1421
version = "0.3.14"
1522
features = [
1623
"Window",
1724
]
1825

26+
[features]
27+
default = []
28+
futures = ["futures_rs", "wasm-bindgen-futures"]
29+
30+
1931
[dev-dependencies]
2032
wasm-bindgen-test = "0.2.37"

0 commit comments

Comments
 (0)