Files
chrome-extensions-samples/samples/appsquare/loader.js
2014-09-02 18:06:16 +02:00

15 lines
386 B
JavaScript

function ImageLoader(url) {
this.url_ = url;
}
ImageLoader.prototype.loadInto = function(imageNode) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function() {
// TODO(mihaip): cache the response into a local filesystem.
imageNode.src = window.webkitURL.createObjectURL(xhr.response);
}
xhr.open('GET', this.url_, true);
xhr.send();
};