Module sycamore::futures

source ·
Expand description

Utilities for Sycamore when working with futures and async.

§Spawning futures

The recommended way to spawn a future is to use the spawn_local_scoped method on the reactive scope. The benefit of using this instead of wasm_bindgen_futures::spawn_local is that the future does not need to be 'static, allowing values in the surrounding scope to be directly referenced from inside the future without any cloning necessary.

§Suspense

To find out more about suspense, read the docs for the suspense module.

Modules§

  • Bindings to JavaScript’s standard, built-in objects, including their methods and properties.

Structs§

  • A Rust Future backed by a JavaScript Promise.

Functions§

  • Create a new async resource.
  • Converts a Rust Future into a JavaScript Promise.
  • If running on wasm32 target, does nothing. Otherwise creates a new tokio::task::LocalSet scope.
  • Runs a Rust Future on the current thread.
  • Spawns a !Send future on the current scope. If the scope is destroyed before the future is completed, it is aborted immediately. This ensures that it is impossible to access any values referencing the scope after they are destroyed.