Socket
Book a DemoInstallSign in
Socket

preload-img

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

preload-img

Parse a magnet URI and return an object of keys/values

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

preload-img travis npm downloads

Preload an image on a webpage

Works best with browserify!

install

npm install preload-img

usage

If you know you'll need to load an image later, you can preload it upfront (when your web app loads) to make sure that it loads instantly later.

var preload = require('preload-img')

preload('/img/spinner.gif')
preload('/img/another-image.png')

Works best when the image has far-future HTTP cache headers set.

real-world example

You can see this module in action on Magic Keyboard. Check the Network Tab in the Web Inspector to see that an image for each letter of the alphabet is loaded before the user has actually typed any letters.

license

MIT. Copyright (c) Feross Aboukhadijeh.

Keywords

preload

FAQs

Package last updated on 19 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts