This commit is contained in:
John Smith
2023-07-02 16:23:04 -05:00
parent e457c0bcc6
commit b5906a52bc
8 changed files with 59 additions and 53 deletions

View File

@@ -23,8 +23,9 @@ impl<T> MustJoinHandle<T> {
} else if #[cfg(feature="rt-tokio")] {
self.join_handle = None;
} else if #[cfg(target_arch = "wasm32")] {
self.join_handle.take().detach();
self.completed = true;
if let Some(jh) = self.join_handle.take() {
jh.detach();
}
} else {
compile_error!("needs executor implementation")
}

View File

@@ -2,6 +2,7 @@ use super::*;
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
use futures_util::future::{select, Either};
pub async fn timeout<F, T>(dur_ms: u32, f: F) -> Result<T, TimeoutError>
where

View File

@@ -14,8 +14,9 @@ cfg_if! {
pub fn debug_ts(ts: u64) -> String {
if is_browser() {
let mut now = Date::now();
let mut date = Date::new_0();
let now = Date::new_0();
now.set_time(Date::now());
let date = Date::new_0();
date.set_time((ts / 1000u64) as f64);
let show_year = now.get_utc_full_year() != date.get_utc_full_year();