Skip to main content

Module compat

Module compat 

Source
Expand description

Platform compatibility layer for WASM and native targets.

Provides unified APIs for spawn and sleep that work on both:

  • Native (tokio runtime) - enabled by native feature
  • WASM (browser event loop via wasm-bindgen-futures) - enabled by wasm feature

Note: When both features are enabled, native takes precedence.

Functionsยง

now_ms
Get current timestamp in milliseconds.
sleep
Async sleep.
sleep_noop
No-op sleep for backtesting (instant return). Use this in backtest mode to skip real delays.
spawn
Spawn an async task.
yield_now
Yield to the event loop without a timer delay.