0.4.1 • Published 3 years ago
@orestbida/link-prefetcher v0.4.1
link-prefetcher
A tiny link prefetcher (yet another one in the sea of prefetching tools). Uses fetch/xhr to prefetch links rather than the link tag.
prefetchHover()
Start prefetching as soon as possible. Abort if the cursor leaves the anchor tag before the prefetch process is done.
prefetchVisible()
Immediately prefetch all visible links (⚠️ use with caution, can eat up a lot of bandwidth).
Installation
npm i @orestbida/link-prefetcherUsage
import { prefetchHover } from 'link-prefetcher';
prefetchHover();or
<script defer src="dist/index.umd.js"></script>
<script>
window.addEventListener('load', () => {
LinkPrefetcher.prefetchHover()
});
</script>License
Distributed under the MIT License. See LICENSE for more information.