Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thunderbug1/streamlit-javascript
Streamlit component to execute javascript code on the client side and get back the result
https://github.com/thunderbug1/streamlit-javascript
javascript python streamlit streamlit-component
Last synced: 25 days ago
JSON representation
Streamlit component to execute javascript code on the client side and get back the result
- Host: GitHub
- URL: https://github.com/thunderbug1/streamlit-javascript
- Owner: thunderbug1
- License: mit
- Created: 2022-02-14T08:31:22.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-19T06:45:31.000Z (over 1 year ago)
- Last Synced: 2024-05-03T03:26:06.002Z (6 months ago)
- Topics: javascript, python, streamlit, streamlit-component
- Language: Python
- Homepage:
- Size: 85 KB
- Stars: 88
- Watchers: 4
- Forks: 3
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Streamlit javascript execution
[![GitHub][github_badge]][github_link] [![PyPI][pypi_badge]][pypi_link]
## Installation
```
pip install streamlit-javascript
```## Getting started
```import streamlit as st
from streamlit_javascript import st_javascriptst.subheader("Javascript API call")
return_value = st_javascript("""await fetch("https://reqres.in/api/products/3").then(function(response) {
return response.json();
}) """)st.markdown(f"Return value was: {return_value}")
print(f"Return value was: {return_value}")
```## Demo
![example image](https://github.com/thunderbug1/streamlit-javascript/blob/master/example.png)
[github_link]: https://github.com/thunderbug1/streamlit-javascript
[github_badge]: https://badgen.net/badge/icon/GitHub?icon=github&color=black&label[pypi_badge]: https://badge.fury.io/py/streamlit-javascript.svg
[pypi_link]: https://pypi.org/project/streamlit-javascript/