PyTerminal - expose the reference through the element (#1921)

* PyTerminal - expose the reference through the element

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Andrea Giammarchi
2024-01-03 16:24:38 +01:00
committed by GitHub
parent 6eca06ac0b
commit 355866a1f1

View File

@@ -1,6 +1,7 @@
// PyScript py-terminal plugin
import { TYPES, hooks } from "../core.js";
import { notify } from "./error.js";
import { defineProperty } from "polyscript/exports";
const SELECTOR = [...TYPES.keys()]
.map((type) => `script[type="${type}"][terminal],${type}-script[terminal]`)
@@ -76,6 +77,7 @@ const pyTerminal = async () => {
terminal.open(target);
fitAddon.fit();
terminal.focus();
defineProperty(element, "terminal", { value: terminal });
};
// branch logic for the worker