Remove unnecessary try / catch blocks when using the winit-based wasm-preview

Commit b2645dff6c and 4b37d9a1f1 introduced the use of spawn, which doesn't thrown anymore.
This commit is contained in:
Simon Hausmann 2025-04-08 10:06:06 +02:00 committed by Simon Hausmann
parent 6aa4c691f0
commit 33561b0457
3 changed files with 3 additions and 19 deletions

View file

@ -85,15 +85,7 @@
async function run() {
await slint.default();
try {
slint.run_event_loop();
// this will trigger a JS exception, so this line will never be reached!
} catch (e) {
// The winit event loop, when targeting wasm, throws a JavaScript exception to break out of
// Rust without running any destructors. Don't rethrow the exception but swallow it, as
// this is no error and we truly want to resolve the promise of this function by returning
// the model markers.
}
slint.run_event_loop();
let selector = ["code.language-slint", ".rustdoc pre.language-slint", "div.highlight-slint div.highlight", "div.highlight-slint\\,no-auto-preview div.highlight"]
.map((sel) => `${sel}:not([class*=slint\\,ignore]):not([class*=slint\\,no-preview])`).join(",");