Skip to content

Commit

Permalink
Add a global reference to the Streamlit library
Browse files Browse the repository at this point in the history
I noticed the Streamlit.setComponentValue() example
was no longer working. For some reason, in the latest
releases the Streamlit library is no longer in the
global namespace. This change adds it back to the
window namespace, so JsCode callbacks in Folium can
return values to Streamlit.
  • Loading branch information
hansthen committed Oct 12, 2024
1 parent 9bcda70 commit 602025a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions streamlit_folium/frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ declare global {
drawnItems: any
feature_group: any
layer_control: any
Streamlit: any
}
}

Expand Down Expand Up @@ -165,6 +166,7 @@ function getPixelatedStyles(pixelated: boolean) {
`
return styles
}
window.Streamlit = Streamlit;

window.initComponent = (map: any, return_on_hover: boolean) => {
map.on("click", onMapClick)
Expand Down

0 comments on commit 602025a

Please sign in to comment.