Skip to content

Commit

Permalink
fix: drop in replacement for wasm target
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenLoc committed May 2, 2023
1 parent d5079b6 commit b40424a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ egui_extras ="0.21"
egui-notify = "0.6.0"
log = "0.4.17"
getrandom = { version = "0.2", features = ["js"] }
web-time = "0.2.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.7"
tracing-wasm = "0.2"
wasm-bindgen-futures = "0.4"
wasm-bindgen-futures = "0.4"
5 changes: 3 additions & 2 deletions src/scoring/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{
ops::Div,
time::{Duration, Instant},
};

use egui::{plot::Plot, Ui};
use web_time::{Instant, Duration};

use crate::settings::TFSetting;
use egui::plot::{Line, PlotPoints};
Expand Down Expand Up @@ -72,7 +72,7 @@ impl Default for ScorePerDuration {
fn default() -> Self {
Self {
elapsed: Duration::from_millis(0),
start: Time(Instant::now()),
start: Time::now(),
state: 0.0,
avg: 0.0,
history: vec![],
Expand Down Expand Up @@ -109,6 +109,7 @@ impl Time {
}
}


fn average(history: &Vec<f64>) -> f64 {
history.iter().sum::<f64>() / history.len() as f64
}

0 comments on commit b40424a

Please sign in to comment.