[next] Fix #1675 - use async runner in py-script too (#1676)

This commit is contained in:
Andrea Giammarchi
2023-09-06 11:28:58 +02:00
committed by GitHub
parent 37d4cb7c48
commit 264675d0c3
4 changed files with 27 additions and 12 deletions

View File

@@ -215,10 +215,11 @@ class PyScriptElement extends HTMLElement {
async connectedCallback() {
if (!this.executed) {
this.executed = true;
const { io, run } = await this._pyodide.promise;
const { io, run, runAsync } = await this._pyodide.promise;
const runner = this.hasAttribute("async") ? runAsync : run;
this.srcCode = await fetchSource(this, io, !this.childElementCount);
this.replaceChildren();
run(this.srcCode);
runner(this.srcCode);
this.style.display = "block";
}
}