New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

imgload

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imgload

imgload loads an image

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

imgload

imgload loads an image src and fires events (properly fires even if image is cached!).

For radical image loading, use the module built with imgload: Mad Basic Loader.

Getting Started

imgload is meant to be consumed in a CommonJS, Browserify environment (though you can also use a pre-bundled version, more below):

npm i imgload

Usage

// require
var imgload = require('imgload')

// setup
var loadme = imgload('image.jpg')

// start!
loadme.start()

Events

Events are fired. Bind to events like so:

loadme.on('error', function(data) {
	// triggered on image error
})

loadme.on('load', function(data) {
	// triggered on image load
})

loadme.on('always', function(data) {
	// triggered on image load
})

The on method returns this for chainability:

loadme
	.on('error', beep)
	.on('load', bop)
	.on('always', boop)

Bundled Version

If you don't want to mess with a build process you can also include the pre-bundled version found in dist/imgload.bundled.js in your project which exposes imgload() globally.

Todo

  • Tests

Keywords

load

FAQs

Package last updated on 16 Aug 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