Crates.io | wasmtimer |
lib.rs | wasmtimer |
version | 0.4.1 |
source | src |
created_at | 2023-02-15 22:19:22.772898 |
updated_at | 2024-11-17 12:47:37.402302 |
description | Time utils from std::time, tokio::time and tokio_util::time on WASM targets |
homepage | |
repository | https://github.com/whizsid/wasmtimer-rs |
max_upload_size | |
id | 786309 |
size | 139,118 |
An implementation of time
based functionalities from std::time
, tokio::time
,
tokio_util::time
for WASM targets. This crate tries to closely
replicate above APIs. Users only have to change their use
scripts by
using a cfg
macro.
#[cfg(not(target_family="wasm"))]
use tokio::time::*;
#[cfg(target_family="wasm")]
use wasmtimer::tokio::*;
Check the API Documentation for more details.
Core idea and core modules in src/timer
folder were copied from
this crate. This crate is
abandoned now due to lack of maintainability. I've hard forked it,
added some additional features and released to use for
this PR.
tokio::time
vs wasmtimer
wasmtimer
is only running on WASM browser targets and not using any
tokio
feature as a dependency.Promise
) in browser scope. If we implemented such without caring
about background tasks, then this implementation will not match with the
tokio's original implementation.serde
feature flag)