---
allow_origins:
- '*'
allow_xss: false
alt_top_banner: ''
auto_reload: false
auto_reload_interval: 5.0
code: ''
mimetype: text/html
no_header: false
no_navheader: false
require_method:
- GET
- POST
require_permissions: []
resource_label_image: 16x9/scifi-control-room.avif
resource_timestamp: 1713116971217800
resource_type: page
setupcode: "from kaithem.api.widgets import APIWidget\r\n\r\napi = APIWidget(echo=False,\
  \ id=\"YourWidgetID\")\r\n\r\ndef f(user: str, value, connection_id: str):\r\n \
  \   api.send_to(f\"Echoing {value} from {user} on {connection_id}\", connection_id)\r\
  \n\r\napi.attach2(f)\r\n"
streaming_response: false
template_engine: jinja2
theme_css_url: ''

---
{% extends "pagetemplate.j2.html" %}

{% block title %}APIWidget Example{% endblock %}

{% block body %}

<script type="module">
    import { kaithemapi, APIWidget} from "/static/js/widget.mjs?cache_version=c6d0887e-af6b-11ef-af85-5fc2044b2ae0"
    let api = new APIWidget("{{api.uuid}}");

    api.upd = (val) => alert(val)
    api.send("MyValue")
</script>

{% endblock %}