Skip to content

Commit

Permalink
Make wasm-bindgen feature override stdweb
Browse files Browse the repository at this point in the history
... instead of trying to include both versions of the now() function in
the build.

Fixes: #23
  • Loading branch information
alvinhochun authored and sebcrozet committed Jul 5, 2020
1 parent 7f43234 commit e66b389
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#[cfg(all(any(target_arch = "wasm32", target_arch = "asmjs"), feature = "stdweb"))]
#[cfg(all(
any(target_arch = "wasm32", target_arch = "asmjs"),
all(feature = "stdweb", not(feature = "wasm-bindgen"))
))]
#[macro_use]
extern crate stdweb;

Expand Down
2 changes: 1 addition & 1 deletion src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn duration_to_f64(d: Duration) -> f64 {
d.as_secs() as f64 * 1.0e3 + f64::from(d.subsec_nanos()) * 1.0e-6
}

#[cfg(feature = "stdweb")]
#[cfg(all(feature = "stdweb", not(feature = "wasm-bindgen")))]
#[allow(unused_results)] // Needed because the js macro triggers it.
pub fn now() -> f64 {
use stdweb::unstable::TryInto;
Expand Down

0 comments on commit e66b389

Please sign in to comment.