Load stuff lazily on the browser.
- only 403 bytes (gzip)
- starts after the page load event
- ignored on the server (relevant for server side rendering)
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 */
() => {
// ...
}
)
⭐ this repo
MIT © siddharthkp
Logo credits to Chris Lau