mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-07 22:18:12 +08:00
Bezier-rs: Made wasm imports async in demos (#1071)
* Made wasm imports async in demos * remove hidden characters to pass linting * Swapped import to use async / await --------- Co-authored-by: Thomas Cheng <contact.chengthomas@gmail.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Thomas Cheng
parent
c8a7e58bd5
commit
2e3495aa0e
@@ -48,7 +48,7 @@ class SubpathDemo extends HTMLElement {
|
||||
}
|
||||
}
|
||||
|
||||
connectedCallback(): void {
|
||||
async connectedCallback(): Promise<void> {
|
||||
this.title = this.getAttribute("title") || "";
|
||||
this.triples = JSON.parse(this.getAttribute("triples") || "[]");
|
||||
this.key = this.getAttribute("key") as SubpathFeatureKey;
|
||||
@@ -58,13 +58,13 @@ class SubpathDemo extends HTMLElement {
|
||||
this.tVariant = (this.getAttribute("tvariant") || "Parametric") as TVariant;
|
||||
|
||||
this.callback = subpathFeatures[this.key].callback as SubpathCallback;
|
||||
this.subpath = WasmSubpath.from_triples(this.triples, this.closed) as WasmSubpathInstance;
|
||||
this.sliderData = Object.assign({}, ...this.sliderOptions.map((s) => ({ [s.variable]: s.default })));
|
||||
this.sliderUnits = Object.assign({}, ...this.sliderOptions.map((s) => ({ [s.variable]: s.unit })));
|
||||
|
||||
this.render();
|
||||
|
||||
const figure = this.querySelector("figure") as HTMLElement;
|
||||
const wasm = await import("@/../wasm/pkg");
|
||||
this.subpath = wasm.WasmSubpath.from_triples(this.triples, this.closed) as WasmSubpathInstance;
|
||||
this.drawDemo(figure);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user