jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/images/basicimagefetcher.js

25 lines
456 B
JavaScript
Raw Normal View History

2016-01-16 11:29:08 -07:00
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
};
});