A tiny link prefetcher (yet another one in the sea of prefetching tools). Uses fetch
/xhr
to prefetch links rather than the link
tag.
Start prefetching as soon as possible. Abort if the cursor leaves the anchor tag before the prefetch process is done.
Immediately prefetch all visible links (
npm i @orestbida/link-prefetcher
import { prefetchHover } from 'link-prefetcher';
prefetchHover();
or
<script defer src="dist/index.umd.js"></script>
<script>
window.addEventListener('load', () => {
LinkPrefetcher.prefetchHover()
});
</script>
Distributed under the MIT License. See LICENSE for more information.