S8-mktg-aero/aero/content/AeroImage.js

34 lines
604 B
JavaScript
Raw Normal View History

2025-05-25 19:37:12 +02:00
export class AeroImage {
constructor(pathname) {
super();
this.pathname = pathname;
}
/**
*
*/
applyAsBackground(target) {
const backgroundImageBuffer = new Image();
const _this = this;
backgroundImageBuffer.onload = function () {
/* assign image from buffer */
target.style.backgroundImage = `url(${backgroundImageBuffer.src})`;
/* notify handler */
if (onLoaded) { onLoaded(); }
};
/* trigger loading */
backgroundImageBuffer.src = pathname;
}
}