이미지 lazy loading 적용

This commit is contained in:
2026-05-14 11:56:31 +09:00
parent 190e9aa151
commit 2879e1ee0a
3 changed files with 49 additions and 28 deletions
+11 -2
View File
@@ -29,11 +29,20 @@ function _onEnter() {
clearTimeout(_timer);
_showLoader(card);
_timer = setTimeout(() => {
_timer = setTimeout(async () => {
_removeLoader();
const thumb = card.querySelector('img.card-thumb');
if (!thumb) return;
_imgEl.src = thumb.src;
// 아직 lazy-load가 안 된 경우 직접 로딩
let src = thumb.src;
if (!src) {
src = await window.api.readImage(card.dataset.filepath) || '';
if (src) thumb.src = src; // 카드에도 캐싱
}
if (!src) return;
_imgEl.src = src;
_visible = true;
_show(card);
}, DELAY);