mirror of
https://github.com/pyscript/pyscript.git
synced 2026-03-01 17:03:33 -05:00
[RC] Work on the reverted changes (#1753)
This commit is contained in:
committed by
GitHub
parent
c9e7fe16e4
commit
e4eedd80bc
18
pyscript.core/test/piratical.html
Normal file
18
pyscript.core/test/piratical.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>Arrr - Piratical PyScript</title>
|
||||
<link rel="stylesheet" href="../dist/core.css" />
|
||||
<script type="module" src="../dist/core.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Arrr</h1>
|
||||
<p>Translate English into Pirate speak...</p>
|
||||
<input type="text" id="english" placeholder="Type English here..." />
|
||||
<button py-click="translate_english">Translate</button>
|
||||
<div id="output"></div>
|
||||
<script type="py" src="./piratical.py" config="./piratical.toml"></script>
|
||||
</body>
|
||||
</html>
|
||||
9
pyscript.core/test/piratical.py
Normal file
9
pyscript.core/test/piratical.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import arrr
|
||||
from js import document
|
||||
|
||||
|
||||
def translate_english(event):
|
||||
input_text = document.querySelector("#english")
|
||||
english = input_text.value
|
||||
output_div = document.querySelector("#output")
|
||||
output_div.innerText = arrr.translate(english)
|
||||
1
pyscript.core/test/piratical.toml
Normal file
1
pyscript.core/test/piratical.toml
Normal file
@@ -0,0 +1 @@
|
||||
packages = ["arrr"]
|
||||
20
pyscript.core/test/split-config.html
Normal file
20
pyscript.core/test/split-config.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>PyScript Config</title>
|
||||
<script type="module">
|
||||
import { config } from "../dist/core.js";
|
||||
console.log(config.mpy);
|
||||
</script>
|
||||
<link rel="stylesheet" href="../dist/core.css">
|
||||
<mpy-config>
|
||||
[[fetch]]
|
||||
files = ["a.py"]
|
||||
</mpy-config>
|
||||
<script type="mpy">
|
||||
import a
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
@@ -15,7 +15,7 @@
|
||||
</script>
|
||||
|
||||
<!-- the worker attribute -->
|
||||
<script type="py" worker="./worker.py" config="./config.json"></script>
|
||||
<script type="py" src="./worker.py" config="./config.json" worker></script>
|
||||
|
||||
<!-- this is only to test the non-blocking behavior -->
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user