@wesib/navigation

Wesib: Navigation Support =========================

Usage no npm install needed!

<script type="module">
  import wesibNavigation from 'https://cdn.skypack.dev/@wesib/navigation';
</script>

README

Wesib: Navigation Support

NPM Build Status Code Quality Coverage GitHub Project API Documentation

This module supports navigation utilizing browser History API.

A Navigation instance available in bootstrap context tracks current Page and navigation event. It should be used for navigation to another page.

A NavigationAgent provided for bootstrap context alters navigation processing or prevents it.

A @RenderPage()-decorated method is called when new page loaded and pre-rendered. The page is loaded when navigating to another URL. The page (or only requested part of it) is loaded from the same URL. The decorated method may alter the loaded page contents.

A PageLoadAgent provided for context can be used to alter document processing of the loaded document. E.g. the agents provided by default:

  • Add scripts from the loaded document if not present yet.

  • Add styles from the loaded document, and removes the ones not present.

  • Update window title.

  • Reload the page if the loaded page revision differs from previously loaded one.

    The page revision is specified by <meta name="wesib-app-rev" value="${rev}"/> meta-tag.

A NavLink, NavElement, and NavAnchor instances can be used to make elements (such as <a href="${url}">...</a>) navigate to target URL with Nsvigation API.

A NavMenu instance serves as an owner of navigation links and activates the links matching current page.