Skip to content

Commit c30ff71

Browse files
committed
v1.0.12
1 parent 7eb86a5 commit c30ff71

File tree

6 files changed

+30
-6
lines changed

6 files changed

+30
-6
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Siddique Hameed",
33
"name": "angular-timer",
4-
"version": "1.0.11",
4+
"version": "1.0.12",
55
"homepage": "https://github.com/siddii/angular-timer",
66
"description": "Angular-Timer : A simple AngularJS directive demonstrating re-usability & interoperability",
77
"repository": {

dist/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
##Change Log
22

3+
###Version 1.0.12
4+
* `clear` method. Please see this PR - https://github.com/siddii/angular-timer/pull/43
5+
36
###Version 1.0.11
47
* `addCDSeconds` method for running countdown timer
58

dist/angular-timer.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* angular-timer - v1.0.11 - 2014-01-10 2:05 PM
2+
* angular-timer - v1.0.12 - 2014-02-03 9:30 PM
33
* https://github.com/siddii/angular-timer
44
*
55
* Copyright (c) 2014 Siddique Hameed
@@ -48,6 +48,10 @@ angular.module('timer', [])
4848
$scope.stop();
4949
});
5050

51+
$scope.$on('timer-clear', function () {
52+
$scope.clear();
53+
});
54+
5155
function resetTimeout() {
5256
if ($scope.timeoutId) {
5357
clearTimeout($scope.timeoutId);
@@ -60,6 +64,7 @@ angular.module('timer', [])
6064
$scope.countdown = $scope.countdownattr && parseInt($scope.countdownattr, 10) > 0 ? parseInt($scope.countdownattr, 10) : undefined;
6165
resetTimeout();
6266
tick();
67+
$scope.isRunning = true;
6368
};
6469

6570
$scope.resume = $element[0].resume = function () {
@@ -69,17 +74,25 @@ angular.module('timer', [])
6974
}
7075
$scope.startTime = new Date() - ($scope.stoppedTime - $scope.startTime);
7176
tick();
77+
$scope.isRunning = true;
7278
};
7379

7480
$scope.stop = $scope.pause = $element[0].stop = $element[0].pause = function () {
81+
$scope.clear();
82+
$scope.$emit('timer-stopped', {millis: $scope.millis, seconds: $scope.seconds, minutes: $scope.minutes, hours: $scope.hours, days: $scope.days});
83+
};
84+
85+
$scope.clear = $element[0].clear = function () {
86+
// same as stop but without the event being triggered
7587
$scope.stoppedTime = new Date();
7688
resetTimeout();
77-
$scope.$emit('timer-stopped', {millis: $scope.millis, seconds: $scope.seconds, minutes: $scope.minutes, hours: $scope.hours, days: $scope.days});
7889
$scope.timeoutId = null;
90+
$scope.isRunning = false;
7991
};
8092

8193
$element.bind('$destroy', function () {
8294
resetTimeout();
95+
$scope.isRunning = false;
8396
});
8497

8598
function calculateTimeUnits() {

dist/angular-timer.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ <h4>
269269
Stops the timer
270270
</td>
271271
</tr>
272+
<tr>
273+
<td>
274+
clear
275+
</td>
276+
<td>
277+
Same as <i>stop</i>. But, without the event being triggered
278+
</td>
279+
</tr>
272280
<tr>
273281
<td>
274282
resume

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Siddique Hameed",
33
"name": "angular-timer",
4-
"version": "1.0.11",
4+
"version": "1.0.12",
55
"homepage": "https://github.com/siddii/angular-timer",
66
"licenses": {
77
"type": "MIT",

0 commit comments

Comments
 (0)