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
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,8 +46,42 @@ The above options are best for multi-page sites. Single-page apps have a few opt
46
46
* Call `quicklink()` against a specific DOM element / component
47
47
* Call `quicklink({urls:[...]})` with a custom set of URLs to prefetch
48
48
49
+
## API
50
+
51
+
`quicklink` accepts an optional options object with the following parameters:
52
+
53
+
*`el`: DOM element to observe for in-viewport links to prefetch
54
+
*`urls`: Static array of URLs to prefetch (instead of observing `document` or a DOM element links in the viewport)
55
+
*`timeout`: Integer for the `requestIdleCallback` timeout. A time in milliseconds by which the browser must execute prefetching. Defaults to 2 seconds.
56
+
*`priority`: String specifying preferred priority for fetches. Defaults to `low`. `high` will attempt to use the `fetch()` API where supported (rather than rel=prefetch)
57
+
58
+
TODO:
59
+
* Explore detecting file-extension of resources and using [rel=preload](https://w3c.github.io/preload/) for `high` priority fetches
60
+
* Explore using [Priority Hints](https://github.com/WICG/priority-hints) for importance hinting
61
+
62
+
## Polyfills
63
+
64
+
`quicklink`:
65
+
66
+
* Includes a very small fallback for [requestIdleCallback](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback)
67
+
* Requires `IntersectionObserver` to be supported (see [CanIUse](https://caniuse.com/#feat=intersectionobserver)). We recommend conditionally polyfillng this feature with a service like Polyfill.io:
0 commit comments