You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,10 +149,24 @@ The prefetching provided by `quicklink` can be viewed as a [progressive enhancem
149
149
150
150
Certain features have layered support. If opting for `{priority:'high'}` and `fetch()` isn't available, XHR will be used instead.
151
151
152
+
## Using the prefetcher directly
153
+
154
+
`quicklink` includes a prefetcher that can be individually imported for use in other projects. After installing `quicklink` as a dependency, you can use it as follows:
155
+
156
+
```html
157
+
<scripttype="module">
158
+
importprefetchfrom'../src/prefetch.mjs';
159
+
160
+
consturls= ['1.html', '2.html'];
161
+
constpromises=urls.map(url=>prefetch(url));
162
+
Promise.all(promises);
163
+
</script>
164
+
```
165
+
152
166
## Related projects
153
167
154
168
* Using [Gatsby](https://gatsbyjs.org)? You already get most of this for free baked in. It uses `Intersection Observer` to prefetch all of the links that are in view and provided heavy inspiration for this project.
155
-
* Want a more data-driven approach? See [Guess.js](https://guessjs.com). It uses analytics and machine-learning to prefetch resources based on how users navigate your site. It also has plugins for Webpack and Gatsby.
169
+
* Want a more data-driven approach? See [Guess.js](https://guessjs.com). It uses analytics and machine-learning to prefetch resources based on how users navigate your site. It also has plugins for [Webpack](https://www.npmjs.com/package/guess-webpack) and [Gatsby](https://www.gatsbyjs.org/docs/optimize-prefetching-with-guessjs/).
0 commit comments