Socket
Book a DemoInstallSign in
Socket

xhr-image

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

xhr-image

XHR-driven Images for progress events

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

xhr-image

XHR-driven Image for progress events.

Installation

Install with component(1):

$ component install component/xhr-image

Example

var XHRImage = require('xhr-image');

var img = new XHRImage('http://i.cloudup.com/0chKjveyrS.png');

img.on('progress', function(e){
  progress.style.width = (e.percent | 0) + '%';
});

img.on('load', function(){
  var el = new Image;
  el.src = URL.createObjectURL(img.xhr.response);
  document.body.appendChild(el);
});

Events

  • open
  • sent
  • receiving
  • load
  • progress

API

Image(src)

Request the given img src.

.xhr

The XHR request.

.abort()

Abort the request.

License

MIT

Keywords

url

FAQs

Package last updated on 28 Jun 2013

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