feat: Adding an event to go back just as the user would. (#3636)

* feat: Adding an event to go back just as the user would.

* fix: Simplification suggested by masenf.

* fix: And now apply the fix to the right function.
This commit is contained in:
abulvenz 2024-07-09 20:18:02 +02:00 committed by GitHub
parent d621115f9b
commit 5071245127
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -509,6 +509,15 @@ def console_log(message: str | Var[str]) -> EventSpec:
return server_side("_console", get_fn_signature(console_log), message=message)
def back() -> EventSpec:
"""Do a history.back on the browser.
Returns:
An event to go back one page.
"""
return call_script("window.history.back()")
def window_alert(message: str | Var[str]) -> EventSpec:
"""Create a window alert on the browser.