Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
core: new timeout only if no activity in progress
Browse files Browse the repository at this point in the history
Change-Id: Ib8b2557e1753161098b675428436b41f613f6d21
  • Loading branch information
jacques42 authored and andi34 committed Aug 2, 2021
1 parent cf11dd6 commit 9921295
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ const photoBooth = (function () {
api.resetTimeOut = function () {
clearTimeout(timeOut);

timeOut = setTimeout(function () {
api.reloadPage();
}, config.picture.time_to_live);
if (!takingPic) {
timeOut = setTimeout(function () {
api.reloadPage();
}, config.picture.time_to_live);
}
};

// reset whole thing
Expand Down Expand Up @@ -328,6 +330,10 @@ const photoBooth = (function () {

takingPic = true;

if (api.isTimeOutPending()) {
api.resetTimeOut();
}

if (config.dev.enabled) {
console.log('Taking photo:', takingPic);
}
Expand Down Expand Up @@ -679,7 +685,6 @@ const photoBooth = (function () {
const chromaimage = config.foldersRoot.keying + '/' + filename;

loader.hide();
api.resetTimeOut();
api.chromaimage = filename;
setMainImage(chromaimage);
};
Expand All @@ -688,6 +693,9 @@ const photoBooth = (function () {

takingPic = false;
remoteBuzzerClient.inProgress(false);

api.resetTimeOut();

if (config.dev.enabled) {
console.log('Taking photo:', takingPic);
}
Expand Down Expand Up @@ -779,8 +787,6 @@ const photoBooth = (function () {
if (!$('#mySidenav').hasClass('sidenav--open')) {
rotaryController.focusSet('#result');
}

api.resetTimeOut();
};

preloadImage.src = imageUrl;
Expand All @@ -790,9 +796,10 @@ const photoBooth = (function () {
}

takingPic = false;

remoteBuzzerClient.inProgress(false);

api.resetTimeOut();

if (config.dev.enabled) {
console.log('Taking photo:', takingPic);
}
Expand Down

0 comments on commit 9921295

Please sign in to comment.