Skip to content

siddharthkp/lazyfetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



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