@orestbida/link-prefetcher
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

link-prefetcher

GitHub GitHub file size in bytes Build

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-prefetcher

Usage

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.

Package Sidebar

Install

npm i @orestbida/link-prefetcher

Weekly Downloads

1

Version

0.4.1

License

MIT

Unpacked Size

7.7 kB

Total Files

8

Last publish

Collaborators

  • orestbida