Skip to content

Commit e1893fa

Browse files
creativedrewyrajexcited
authored andcommitted
Added handling to allow just setting countdown timer value.
The "timer-set-countdown-seconds" event allows the user to set the value the countdown timer will start from, without immediately starting the clock going.
1 parent 8f0792a commit e1893fa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/js/timer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ angular.module('timer', [])
157157
$scope.addCDSeconds(extraSeconds);
158158
});
159159
});
160+
161+
$scope.$on('timer-set-countdown-seconds', function(e, countdownSeconds) {
162+
if (!$scope.isRunning) {
163+
$scope.clear();
164+
}
165+
166+
$scope.countdown = countdownSeconds;
167+
$scope.millis = countdownSeconds * 1000;
168+
calculateTimeUnits();
169+
});
160170
} else {
161171
$scope.millis = 0;
162172
}

0 commit comments

Comments
 (0)