npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

xhr-image

0.0.1

@tjholowaychuk

npmSnykSocket
Downloads:0
$ npm install xhr-image
DailyWeeklyMonthlyYearly

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