🔄 Tiny script for loading styles or scripts asynchronously.
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Cornelius Ukena b6ff7f540d init commit
2018-06-04 12:09:45 -05:00
dist init commit 2018-06-04 12:09:45 -05:00
src init commit 2018-06-04 12:09:45 -05:00
.eslintrc.json init commit 2018-06-04 12:09:45 -05:00
.gitignore init commit 2018-06-04 12:09:45 -05:00
LICENSE init commit 2018-06-04 12:09:45 -05:00
package.json init commit 2018-06-04 12:09:45 -05:00
README.md init commit 2018-06-04 12:09:45 -05:00
rollup.config.js init commit 2018-06-04 12:09:45 -05:00
yarn.lock init commit 2018-06-04 12:09:45 -05:00

LorS

LorS is simply a tiny, little script (684B) to load styles or scripts asynchronously on a page. No, it's not always something you really need. But I like to have it every-so-often for really lightweight projects.
Yes, it loads styles asynchronously. Yes, it supports modules in modern browser.

Sorry, no love for stylesheets in Edge. Stylesheets will still load, but they will not be asynchronous.

Usage

lors(type, attributes [, done [, error]])

<script src="https://unpkg.com/lors"></script>
<script>
    lors('script', { src: '/assets/js/app.js' }, function (event) {
        console.log('SUCCESS');
    }, function (event) {
        console.log('FAIL');
    });
    
    lors('link', { href: '/assets/css/app.css' }, function (event) {
        console.log('SUCCESS');
    }, function (event) {
        console.log('FAIL');
    });
</script>