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

core: new timeout only if no activity in progress #273

Merged
merged 1 commit into from
Aug 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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