Skip to content

Commit

Permalink
Add a visitRendered() callback that web fragments can use.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayohms committed Mar 31, 2022
1 parent c207eac commit e47f80f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ internal class TurboWebFragmentDelegate(
}

override fun visitRendered() {
callback.onVisitRendered(location)
navDestination.fragmentViewModel.setTitle(title())
removeTransitionalViews()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ interface TurboWebFragmentCallback {
*/
fun onVisitStarted(location: String) {}

/**
* Called when a Turbo visit has rendered (from a cached snapshot or
* from a fresh network request). This may be called multiple times
* during a normal visit lifecycle.
*/
fun onVisitRendered(location: String) {}

/**
* Called when a Turbo visit has completed.
*/
Expand Down

0 comments on commit e47f80f

Please sign in to comment.