mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
46 lines
1.3 KiB
HTML
46 lines
1.3 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
<title>Async Await NON-BLOCKING Pyscript Twice</title>
|
|
<link
|
|
rel="stylesheet"
|
|
href="https://pyscript.net/latest/pyscript.css"
|
|
/>
|
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
|
</head>
|
|
<body>
|
|
<div>
|
|
Pyscript - FIRST ASYNC WITH NON-BLOCKING AWAIT AT ONE LEVEL LOWER
|
|
THAN LOOP Pyscript writing to console.log:
|
|
<py-script>
|
|
import js
|
|
import asyncio
|
|
|
|
async def asyncCall1():
|
|
await asyncio.sleep(2)
|
|
|
|
for i in range(3):
|
|
js.console.log('A', i)
|
|
asyncCall1()
|
|
</py-script>
|
|
</div>
|
|
<div>
|
|
Pyscript - SECOND ASYNC WITH NON-BLOCKING AWAIT AT ONE LEVEL LOWER
|
|
THAN LOOP Pyscript writing to console.log:
|
|
<py-script>
|
|
import js
|
|
import asyncio
|
|
|
|
async def asyncCall2():
|
|
await asyncio.sleep(2)
|
|
|
|
for i in range(3):
|
|
js.console.log('B', i)
|
|
asyncCall2()
|
|
</py-script>
|
|
</div>
|
|
</body>
|
|
</html>
|