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

Commit

Permalink
core(constants): add more time constants
Browse files Browse the repository at this point in the history
Time settings should be defined once as constant.

Change-Id: I25623fcd819d0cdc0e21511cb577bbb03fa31474
  • Loading branch information
andi34 committed Jan 31, 2022
1 parent 6df69f5 commit 30cbea4
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ const photoBooth = (function () {
videoView = idVideoView.get(0),
videoPreview = idVideoPreview.get(0),
videoSensor = document.querySelector('#video--sensor'),
cheeseTime = config.picture.no_cheese ? 0 : config.picture.cheese_time;
cheeseTime = config.picture.no_cheese ? 0 : config.picture.cheese_time,
timeToLive = config.picture.time_to_live * 1000,
continuousCollageTime = config.collage.continuous_time * 1000,
retryTimeout = config.picture.retry_timeout * 1000;

const PhotoStyle = {
PHOTO: 'photo',
Expand Down Expand Up @@ -85,14 +88,10 @@ const photoBooth = (function () {
photoboothTools.console.log('Timeout for auto reload cleared.');

if (!takingPic) {
photoboothTools.console.logDev(
'Timeout for auto reload set to',
config.picture.time_to_live * 1000,
' seconds.'
);
photoboothTools.console.logDev('Timeout for auto reload set to', timeToLive, ' milliseconds.');
timeOut = setTimeout(function () {
photoboothTools.reloadPage();
}, config.picture.time_to_live * 1000);
}, timeToLive);
}
};

Expand Down Expand Up @@ -191,7 +190,7 @@ const photoBooth = (function () {
retry += 1;
setTimeout(function () {
api.getAndDisplayMedia(mode, retry);
}, retry * 1000);
}, retryTimeout);
}
});
};
Expand Down Expand Up @@ -506,7 +505,7 @@ const photoBooth = (function () {
);
setTimeout(() => {
api.thrill(data.style, retry);
}, config.picture.retry_timeout * 1000);
}, retryTimeout);
} else {
api.errorPic(result);
}
Expand Down Expand Up @@ -544,7 +543,7 @@ const photoBooth = (function () {
imageUrl = '';
loaderImage.css('display', 'none');
api.thrill(PhotoStyle.COLLAGE);
}, config.collage.continuous_time * 1000);
}, continuousCollageTime);
} else {
currentCollageFile = '';
nextCollageNumber = 0;
Expand All @@ -553,7 +552,7 @@ const photoBooth = (function () {
imageUrl = '';
loaderImage.css('display', 'none');
api.processPic(data.style, result);
}, config.collage.continuous_time * 1000);
}, continuousCollageTime);
}
} else {
// collage with interruption
Expand Down

0 comments on commit 30cbea4

Please sign in to comment.