Sample Usage
src/__init__.fyre
python
from .parent import parent
from .store import store
def mocked_request():
return "fetched on the server"
async def handle_on_click(e):
alert("click rendered on client")
if 1==1:
print("Hello world")
current_value = get_parent_signal()
set_parent_signal(current_value + 1)
a = await fetch('https://jsonplaceholder.typicode.com/todos/1')
print(await a.text())
print("handles on click")
<style>
body {
background-color: red;
}
</style>
<pyml>
<store>
<parent hello='world'>
<span onclick={handle_on_click}>
{[ mocked_request() for i in range(4)]}
</span>
</parent>
</store>
</pyml>
<script>
// this is the optional section
// for third party scripts and custom js
</script>
src/parent.fyre
python
import requests
def ssr_request():
text = "Hello"
if text != "":
return text + " from Server Side"
else:
return "No response"
<pyml>
<span>
<div>
{ssr_request()}
</div>
<b>
{use_parent_signal()}
</b>
<b>
{get_parent_signal()}
</b>
<div>
This won't be re-rendered
</div>
</span>
</pyml>