Available on non-WebAssembly only.
Expand description
The dedicated JS thread: owns the V8 isolate, runs the React bundle, and exposes the ops that form the whole Rust<->JS boundary.
The bundle is split in two (see examples/.../build.mjs): a vendor
script (react, react-reconciler, the bevy-react runtime) executed once and
never re-run, and an app script (the user’s components) re-executed on
every edit. On a hot reload the isolate is KEPT ALIVE: we re-execute_script
the rebuilt app, which re-registers components and drives a React Fast
Refresh (hook state preserved). Only if that fails do we fall back to tearing
the whole runtime down and rebuilding it.
Functions§
- spawn_
js_ thread - Spawn the JS thread. Builds the isolate once and keeps it alive across hot reloads (re-executing only the app bundle); runs until shutdown.