jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/images/basicimagefetcher.js
2016-01-20 20:05:14 -05:00

25 lines
456 B
JavaScript

define([], function () {
function loadImage(elem, url) {
if (elem.tagName !== "IMG") {
var tmp = new Image();
tmp.onload = function () {
elem.style.backgroundImage = "url('" + url + "')";
};
tmp.src = url;
} else {
elem.setAttribute("src", url);
}
return Promise.resolve(elem);
}
return {
loadImage: loadImage
};
});