only rust changes reset scene (#6060)

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-03-29 11:43:42 -07:00
committed by GitHub
parent 6532b23f1c
commit 51c16d0048
5 changed files with 126 additions and 8 deletions

View File

@ -85,6 +85,21 @@ impl Context {
}
}
/// Reset the scene and bust the cache.
/// ONLY use this if you absolutely need to reset the scene and bust the cache.
#[wasm_bindgen(js_name = bustCacheAndResetScene)]
pub async fn bust_cache_and_reset_scene(&self, settings: &str, path: Option<String>) -> Result<JsValue, String> {
console_error_panic_hook::set_once();
let ctx = self.create_executor_ctx(settings, path, false)?;
match ctx.bust_cache_and_reset_scene().await {
// The serde-wasm-bindgen does not work here because of weird HashMap issues.
// DO NOT USE serde_wasm_bindgen::to_value it will break the frontend.
Ok(outcome) => JsValue::from_serde(&outcome).map_err(|e| e.to_string()),
Err(err) => Err(serde_json::to_string(&err).map_err(|serde_err| serde_err.to_string())?),
}
}
/// Execute a program in mock mode.
#[wasm_bindgen(js_name = executeMock)]
pub async fn execute_mock(