mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-28 13:39:44 +07:00
15 lines
386 B
JavaScript
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();
|
|
};
|