optimize live preview

This commit is contained in:
Vladimir Mandic
2023-06-09 12:29:50 -04:00
parent 0109052fdd
commit e8e260408f
2 changed files with 9 additions and 7 deletions
+2 -1
View File
@@ -116,6 +116,7 @@ function requestProgress(id_task, progressEl, galleryEl, atEnd = null, onProgres
};
const start = (id_task, id_live_preview) => {
console.log('HERE start', id_task, id_live_preview, opts.live_preview_refresh_period)
request('./internal/progress', { id_task, id_live_preview }, (res) => {
lastState = res;
const elapsedFromStart = (new Date() - dateStart) / 1000;
@@ -128,7 +129,7 @@ function requestProgress(id_task, progressEl, galleryEl, atEnd = null, onProgres
if (res.live_preview && !livePreview) init();
if (res.live_preview && galleryEl) img.src = res.live_preview;
if (onProgress) onProgress(res);
setTimeout(() => start(id_task, res.id_live_preview), opts.live_preview_refresh_period || 250);
setTimeout(() => start(id_task, id_live_preview), opts.live_preview_refresh_period || 250);
}, done);
};
start(id_task, 0);