Skip to content

Commit fa13697

Browse files
committed
Apparently I forgot PyScript FFI docs
1 parent c5f8d68 commit fa13697

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

docs/examples/python/pyscript_ffi.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from pyscript import document, window
2+
from reactpy import component, html
3+
4+
5+
@component
6+
def root():
7+
def on_click(event):
8+
my_element = document.querySelector("#example")
9+
my_element.innerText = window.location.hostname
10+
11+
return html.div(
12+
{"id": "example"},
13+
html.button({"onClick": on_click}, "Click Me!"),
14+
)

docs/src/reference/template-tag.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,17 @@ The entire file path provided is loaded directly into the browser, and must have
214214
{% include "../../examples/python/pyodide_js_module.py" %}
215215
```
216216

217-
**PyScript FFI**
217+
**PyScript Foriegn Function Interface (FFI)**
218218

219-
...
219+
PyScript FFI has similar functionality to Pyodide's `js` module, but utilizes a different API.
220+
221+
There are two importable modules available that are available within the FFI interface: `window` and `document`.
222+
223+
=== "root.py"
224+
225+
```python
226+
{% include "../../examples/python/pyscript_ffi.py" %}
227+
```
220228

221229
**PyScript JS Modules**
222230

0 commit comments

Comments
 (0)