NavigationListener
@WebNavigationClient.ExperimentalNavigationCallback
interface NavigationListener
Page identification and lifecycle APIs.
This class provides callbacks to identify the different stages of navigation. For more information about the navigation lifecycle, please see the Life of a Navigation Presentation.
Note: These navigation callbacks only fire for navigations happening on the main frame.
Navigation lifecycle events:
onNavigationStarted- Potentially zero or more
onNavigationRedirectedevents onNavigationCompleted- If the navigation commits and is not a same-document navigation, potentially any combination and order of zero or one of each of:
Summary
Public functions |
|
|---|---|
Unit |
onFirstContentfulPaint(page: Page, loadTimeUs: Long)Called when the page achieves "First Contentful Paint". |
Unit |
onNavigationCompleted(navigation: Navigation)Called when a navigation completes. |
Unit |
onNavigationRedirected(navigation: Navigation)Called when a navigation is redirected. |
Unit |
onNavigationStarted(navigation: Navigation)Called when a navigation starts, including same-document navigations. |
Unit |
onPageDeleted(page: Page)Called when any Page is evicted/destroyed. |
Unit |
onPageDomContentLoadedEvent(page: Page)Called when the |
Unit |
onPageLoadEvent(page: Page)Called when the |
Public functions
onFirstContentfulPaint
fun onFirstContentfulPaint(page: Page, loadTimeUs: Long): Unit
Called when the page achieves "First Contentful Paint".
See First Contentful Paint (FCP) for a definition.
onNavigationCompleted
fun onNavigationCompleted(navigation: Navigation): Unit
Called when a navigation completes.
The navigation might not have actually committed (e.g., results in 204/download/cancelled).
| Parameters | |
|---|---|
navigation: Navigation |
The Navigation object representing the completed navigation. |
onNavigationRedirected
fun onNavigationRedirected(navigation: Navigation): Unit
Called when a navigation is redirected.
| Parameters | |
|---|---|
navigation: Navigation |
The Navigation object representing the redirected navigation. |
onNavigationStarted
fun onNavigationStarted(navigation: Navigation): Unit
Called when a navigation starts, including same-document navigations.
Note: These navigation callbacks only fire for navigations happening on the main frame.
| Parameters | |
|---|---|
navigation: Navigation |
The Navigation object representing the started navigation. |
onPageDeleted
fun onPageDeleted(page: Page): Unit
Called when any Page is evicted/destroyed. This can occur immediately on navigation, or later if the page is BFCached and subsequently evicted.
| Parameters | |
|---|---|
page: Page |
The Page that was evicted or destroyed. |
onPageDomContentLoadedEvent
fun onPageDomContentLoadedEvent(page: Page): Unit
Called when the DOMContentLoaded event is fired for the current page.
| Parameters | |
|---|---|
page: Page |
The Page for which the |
onPageLoadEvent
fun onPageLoadEvent(page: Page): Unit
Called when the window.load event is fired for the current page.
| Parameters | |
|---|---|
page: Page |
The Page for which the |