Files
chrome-extensions-samples/apps/samples/appsquare/loader.js
Sam Thorogood 8af19b8ca9 move
2020-12-04 09:18:01 +11: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();
};