Load stuff lazily on the browser.
- only 376 bytes (gzip)
- ignored on the server (relevant for server side rendering)
Usage
npm install lazyfetch --save
import lazyfetch from 'lazyfetch'
lazyfetch(
/* list of urls to load */
[
'https://example.com/script.js',
'https://example.com/styles.css'
],
/* callback to execute after all of the urls have been fetched */
() => {
// ...
}
)
or load in the browser
<script async src="https://unpkg.com/lazyfetch/lib.js"></script>
like it?
license
MIT © siddharthkp
Logo credits to Chris Lau