Back to Content

NavigationTransition

files/en-us/web/api/navigationtransition/index.md

latest1.7 KB
Original Source

{{APIRef("Navigation API")}}

The NavigationTransition interface of the {{domxref("Navigation API", "Navigation API", "", "nocode")}} represents an ongoing navigation, that is, a navigation that hasn't yet reached the {{domxref("Navigation/navigatesuccess_event", "navigatesuccess")}} or {{domxref("Navigation/navigateerror_event", "navigateerror")}} stage.

It is accessed via the {{domxref("Navigation.transition")}} property.

{{InheritanceDiagram}}

Instance properties

  • {{domxref("NavigationTransition.finished", "finished")}} {{ReadOnlyInline}}
    • : Returns a {{jsxref("Promise")}} that fulfills at the same time the {{domxref("Navigation/navigatesuccess_event", "navigatesuccess")}} event fires, or rejects at the same time the {{domxref("Navigation/navigateerror_event", "navigateerror")}} event fires.
  • {{domxref("NavigationTransition.from", "from")}} {{ReadOnlyInline}}
    • : Returns the {{domxref("NavigationHistoryEntry")}} that the transition is coming from.
  • {{domxref("NavigationTransition.navigationType", "navigationType")}} {{ReadOnlyInline}}
    • : Returns the type of the ongoing navigation.

Examples

js
async function cleanupNavigation() {
  await navigation.transition.finished;
  // Navigation has completed successfully
  // Cleanup any ongoing monitoring
}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also