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.

js

        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.

js

        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.

js

        const element = document.querySelector('div#new-added-content');
        window.papel.highlightMatchingLinks(element);
        

Navigate

This function programmatically navigates to a specified URL.

js

        window.papel.navigate('/new-page');
        

StartLoading

This function starts a loading indicator, useful for indicating that a background process is running.

js

        window.papel.startLoading();
        

StopLoading

This function stops the loading indicator started by startLoading.

js

        window.papel.stopLoading();