Skip to content

Commit

Permalink
Merge pull request #223 from hotwired/visit-rendered-callback
Browse files Browse the repository at this point in the history
Add a visitRendered() callback that web fragments can use
  • Loading branch information
jayohms authored Apr 1, 2022
2 parents 8e753ef + e47f80f commit e659f08
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 e659f08

Please sign in to comment.