Programmatic API
InterceptLinks
This function intercepts click events on all links with the
pl-boost
attribute, allowing the page navigation to be
handled programmatically using the Fetch API.
const element = document.querySelector('div#new-added-content');
window.papel.interceptLinks(element);
PrefetchLinks
This function prefetches the content of all links marked with the
data-prefetch
attribute as soon as they become visible
in the viewport.
const element = document.querySelector('div#new-added-content');
window.papel.prefetchLinks(element);
HighlightMatchingLinks
This function highlights all links on the page that partially or completely match the current URL path.
const element = document.querySelector('div#new-added-content');
window.papel.highlightMatchingLinks(element);
Navigate
This function programmatically navigates to a specified URL.
window.papel.navigate('/new-page');
StartLoading
This function starts a loading indicator, useful for indicating that a background process is running.
window.papel.startLoading();
StopLoading
This function stops the loading indicator started by
startLoading
.
window.papel.stopLoading();