mirror of
https://github.com/pyscript/pyscript.git
synced 2026-04-04 20:00:24 -04:00
support different pyodide versions (#328)
* add PyLoader class * create global loader during app creation time and remove it when pyscript loading operations are done * make the loader global and open/close when apps is starting. Also add concept of app config so users can set if they want to autoclose the loader of handle it themselves * add pyconfig file * auto add global config if there's no config set in the page * export initializer type * define type for config * move initialization out of svelte file, into app config * change runtimes from strings to objects * fix typo
This commit is contained in:
@@ -14,6 +14,14 @@
|
||||
- paths:
|
||||
- ./utils.py
|
||||
</py-env>
|
||||
<py-config>
|
||||
- autoclose_loader: false
|
||||
- runtimes:
|
||||
-
|
||||
src: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js"
|
||||
name: pyodide-0.20
|
||||
lang: python
|
||||
</py-config>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -43,6 +51,8 @@ async def foo():
|
||||
else:
|
||||
out3.clear()
|
||||
|
||||
# close the global PyScript pyscript_loader
|
||||
pyscript_loader.close()
|
||||
pyscript.run_until_complete(foo())
|
||||
</py-script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user