mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 21:03:00 +00:00
Remove unnecessary try / catch blocks when using the winit-based wasm-preview
Commitb2645dff6cand4b37d9a1f1introduced the use of spawn, which doesn't thrown anymore.
This commit is contained in:
parent
6aa4c691f0
commit
33561b0457
3 changed files with 3 additions and 19 deletions
|
|
@ -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.
|
||||
}
|
||||
|
||||
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(",");
|
||||
|
|
|
|||
|
|
@ -109,11 +109,7 @@ function getPreviewHtml(
|
|||
|
||||
const vscode = acquireVsCodeApi();
|
||||
let promises = {};
|
||||
try {
|
||||
slint_preview.run_event_loop();
|
||||
} catch (_) {
|
||||
// This is actually not an error:-/
|
||||
}
|
||||
|
||||
const canvas_id = "canvas";
|
||||
|
||||
|
|
|
|||
|
|
@ -222,11 +222,7 @@ export class Lsp {
|
|||
style: string,
|
||||
): Promise<Previewer> {
|
||||
if (this.#preview_connector === null) {
|
||||
try {
|
||||
slint_preview.run_event_loop();
|
||||
} catch (e) {
|
||||
// this is not an error!
|
||||
}
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const experimental = params.get("SLINT_EXPERIMENTAL_FEATURES");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue