GoogleChromeLabs / GoogleChromeLabs/quicklink

Facilitate async loading of quicklink.umd.js

Open
#81 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
11.3k
Forks
429
PR merge metrics
No merged PRs in 30d

Description

Currently the readme suggests to include the script into the page via:

```html

quicklink();

```

or at `load` event via:

```html

window.addEventListener('load', () =>{
quicklink();
});

```

However, shouldn't the `quicklink.umd.js` script be loaded with `async` to begin with? The blocking script is not good for performance.

Ideally you should be able to do something like this, similar to the [AMP shadow doc API](https://github.com/ampproject/amphtml/blob/master/spec/amp-shadow-doc.md#using-shadow-doc-api):

```html

(window.quicklink = window.quicklink || []).push(function(quicklink) {
quicklink();
});
// Or...
window.addEventListener('load', () =>{
(window.quicklink = window.quicklink || []).push(function(quicklink) {
quicklink();
});
});

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.