-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Description
I faced an issue when passing seconds & duration to timer.
Suppose I passed 300 to seconds & 4 mins as duration than the timer never stops and the callback is never called.
Line number 260 in timer.jquery.js:
if (timerInstance.totalSeconds > 0 &&
timerInstance.totalSeconds % timerInstance.config.duration === 0) {
if (timerInstance.config.callback) {
timerInstance.config.callback();
}
if (!timerInstance.config.repeat) {
clearInterval(timerInstance.intervalId);
setState(timerInstance, Constants.TIMER_STOPPED);
timerInstance.config.duration = null;
}
}
I have changed it to :
if (timerInstance.totalSeconds > 0 && (
timerInstance.totalSeconds % timerInstance.config.duration === 0 ||
timerInstance.totalSeconds > timerInstance.config.duration )) {
if (timerInstance.config.callback) {
timerInstance.config.callback();
}
if (!timerInstance.config.repeat) {
clearInterval(timerInstance.intervalId);
setState(timerInstance, Constants.TIMER_STOPPED);
timerInstance.config.duration = null;
}
}
Might save someones day.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels