Skip to content

Commit 8cc8eb4

Browse files
committed
Restart dom monitoring when download has finished
1 parent 07af240 commit 8cc8eb4

File tree

2 files changed

+198
-196
lines changed

2 files changed

+198
-196
lines changed

octoprint_gcodethumbs/static/js/gcode-preview-viewmodel.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ $(function() {
3434

3535
if (elements.length)
3636
enrichWithPreview(elements[0]);
37-
38-
timer = setTimeout(monitorDom, 1000);
37+
else
38+
timer = setTimeout(monitorDom, 1000);
3939
}
4040

4141
function getElements() {
@@ -104,11 +104,13 @@ $(function() {
104104
// attach to DOM
105105
insertAfter(canvas, element.querySelector('.title'));
106106
}
107+
timer = setTimeout(monitorDom, 1000);
107108
})
108109
.catch(function(e) {
109110
console.warn('error while getting file', e);
110111
downloading = false;
111112
errors[filename] = e;
113+
timer = setTimeout(monitorDom, 1000);
112114
});
113115
}
114116

0 commit comments

Comments
 (0)