You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several situations where the user might want to run simple JavaScript on-demand.
For example, in Django-IDOM when a sign out button is clicked, the user is signed out from the backend but there's no way to window.location.reload or set the current window.location = ....
Or, if using non-react libraries (ex. classic bootstrap), it would be convenient to be able to run $("#modal").toggle().
Proposed Changes
Allow components to have some way of running some arbitrary JavaScript.
# This feels like the most pythonic to exec a scriptidom.exec_script("window.location.reload()");
Option 3: Script Tag
# This feels like the most IDOM-like method of script execution# Should be executed if the internal contents of the `script` tag has changed.idom.html.div(
idom.html.script("window.location.reload()")
)
Activity
Archmonger commentedon Dec 31, 2021
I added in a third option which I believe to be the easiest to develop, from IDOM's perspective.
rmorshea commentedon Jan 9, 2022
I think I like option 3 in order to make this front-end independent. For example a front-end can just choose not to support a
scripttag.[-]Eval-able script parameter in components[/-][+]Implement a script tag[/+]