Skip to content

Commit

Permalink
Added handling to allow just setting countdown timer value.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
creativedrewy committed Apr 30, 2014
1 parent f4f6fce commit b81abbf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/js/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ angular.module('timer', [])
$scope.addCDSeconds(extraSeconds);
});
});

$scope.$on('timer-set-countdown-seconds', function(e, countdownSeconds) {
if (!$scope.isRunning) {
$scope.clear();
}

$scope.countdown = countdownSeconds;
$scope.millis = countdownSeconds * 1000;
calculateTimeUnits();
});
} else {
$scope.millis = 0;
}
Expand Down

0 comments on commit b81abbf

Please sign in to comment.