xhr-image

XHR-driven Images for progress events

xhr-image

XHR-driven Image for progress events.

Install with component(1):

$ component install component/xhr-image
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);
});
  • open
  • sent
  • receiving
  • load
  • progress

Request the given img src.

The XHR request.

Abort the request.

MIT