Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
fix: use instant::Instant instead of std::time::Instant for better co…
Browse files Browse the repository at this point in the history
…mpatibility
  • Loading branch information
youngjoon-lee committed May 10, 2023
1 parent 64c812a commit 15e8835
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 199 deletions.
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ name = "wasm-timer"
edition = "2018"
description = "Abstraction over std::time::Instant and futures-timer that works on WASM"
version = "0.2.5"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
authors = ["Youngjoon Lee <taxihighway@gmail.com>"]
license = "MIT"
repository = "https://github.com/tomaka/wasm-timer"
repository = "https://github.com/youngjoon-lee/wasm-timer"

# [features]
# wasm-bindgen = ["instant/wasm-bindgen"]

[dependencies]
futures = "0.3.1"
instant = "0.1.12"
parking_lot = "0.11"
pin-utils = "0.1.0"

Expand All @@ -17,6 +21,7 @@ js-sys = "0.3.31"
wasm-bindgen = "0.2.37"
wasm-bindgen-futures = "0.4.4"
web-sys = { version = "0.3.31", features = ["Performance", "Window"] }
instant = { version = "0.1.12", features = ["wasm-bindgen"] }

[dev-dependencies]
async-std = "1.0"
8 changes: 2 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@

pub use timer::*;

#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
pub use std::time::{Instant, SystemTime, UNIX_EPOCH};
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
pub use wasm::*;
pub use instant::{Instant, SystemTime};
pub use std::time::UNIX_EPOCH;

mod timer;
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
mod wasm;
2 changes: 1 addition & 1 deletion src/timer/global/desktop.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use instant::Instant;
use std::future::Future;
use std::io;
use std::mem::{self, ManuallyDrop};
Expand All @@ -6,7 +7,6 @@ use std::sync::Arc;
use std::task::{Context, RawWaker, RawWakerVTable, Waker};
use std::thread;
use std::thread::Thread;
use std::time::Instant;

use pin_utils::pin_mut;

Expand Down
190 changes: 0 additions & 190 deletions src/wasm.rs

This file was deleted.

0 comments on commit 15e8835

Please sign in to comment.