forked from phoenixframework/phoenix_live_view
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR introduces a new option that can be specified when creating a livesocket instance: `navigation`. Navigation is an object that can define two functions: `beforeEach` and `afterEach`. The `beforeEach` function is called before each navigation event and can for example be used to store custom scroll positions. If the `beforeEach` function returns `false`, the navigation will be aborted. This can be used to implement a warning when the user tries to navigate while a form is still being edited. The `afterEach` function is called after a navigation event has been completed. It can be used to restore the scroll position that was stored in the `beforeEach` function.
- Loading branch information
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters