Skip to content

Commit

Permalink
feat: Adding an event to go back just as the user would. (reflex-dev#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
abulvenz authored Jul 9, 2024
1 parent d621115 commit 5071245
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions reflex/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5071245

Please sign in to comment.