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: site/src/_includes/components/usage.njk
+8-12Lines changed: 8 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -4,35 +4,31 @@
4
4
{{"Once initialized, `quicklink` will automatically prefetch URLs for links that are in-viewport during idle time." | markdown | safe}}
5
5
6
6
{{"Quickstart:" | markdown | safe}}
7
-
{%markdownConvert%}
8
-
```
7
+
8
+
{%highlight"html"%}
9
9
<!-- Include quicklink from dist -->
10
10
<scriptsrc="dist/quicklink.umd.js"></script>
11
11
<!-- Initialize (you can do this whenever you want) -->
12
12
<script>
13
13
quicklink.listen();
14
14
</script>
15
-
```
16
-
{%endmarkdownConvert%}
15
+
{%endhighlight%}
17
16
18
17
{{"For example, you can initialize after the `load` event fires:" | markdown | safe}}
19
-
{%markdownConvert%}
20
-
```html
18
+
{%highlight"html"%}
21
19
<script>
22
20
window.addEventListener('load', () => {
23
21
quicklink.listen();
24
22
});
25
23
</script>
26
-
```
27
-
{%endmarkdownConvert%}
24
+
{%endhighlight%}
28
25
29
26
{{"ES Module import:" | markdown | safe}}
30
-
{%markdownConvert%}
31
-
```js
27
+
{%highlight"js"%}
32
28
import quicklink from "quicklink/dist/quicklink.mjs";
33
29
quicklink.listen();
34
-
```
35
-
{%endmarkdownConvert%}
30
+
{%endhighlight%}
31
+
36
32
{{"The above options are best for multi-page sites. Single-page apps have a few options available for using quicklink with a router:" | markdown | safe}}
37
33
{{"* Call `quicklink.listen()` once a navigation to a new route has completed" | markdown | safe}}
38
34
{{"* Call `quicklink.listen()` against a specific DOM element / component" | markdown | safe}}
0 commit comments