이미지 lazy loading 적용
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user