/lazyfetch

Load stuff lazily on the browser

Primary LanguageJavaScriptMIT LicenseMIT



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)

 

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 */
  () => {
    // ...
  }
)

 

like it?

⭐ this repo

 

license

MIT © siddharthkp

Logo credits to Chris Lau