1
1
/**
2
- * angular-timer - v1.3.4 - 2016-05-01 9:52 PM
2
+ * angular-timer - v1.3.5 - 2017-02-14 1:19 PM
3
3
* https://github.com/siddii/angular-timer
4
4
*
5
- * Copyright (c) 2016 Siddique Hameed
5
+ * Copyright (c) 2017 Adrian Wardell
6
6
* Licensed MIT <https://github.com/siddii/angular-timer/blob/master/LICENSE.txt>
7
7
*/
8
- var humanizeDuration = require ( "humanize-duration" ) ;
9
- var moment = require ( "moment" ) ;
10
8
var timerModule = angular . module ( 'timer' , [ ] )
11
9
. directive ( 'timer' , [ '$compile' , function ( $compile ) {
12
10
return {
@@ -123,7 +121,7 @@ var timerModule = angular.module('timer', [])
123
121
}
124
122
} ) ;
125
123
126
- $scope . start = $element [ 0 ] . start = function ( ) {
124
+ $scope . start = function ( ) {
127
125
$scope . startTime = $scope . startTimeAttr ? moment ( $scope . startTimeAttr ) : moment ( ) ;
128
126
$scope . endTime = $scope . endTimeAttr ? moment ( $scope . endTimeAttr ) : null ;
129
127
if ( ! angular . isNumber ( $scope . countdown ) ) {
@@ -134,7 +132,7 @@ var timerModule = angular.module('timer', [])
134
132
$scope . isRunning = true ;
135
133
} ;
136
134
137
- $scope . resume = $element [ 0 ] . resume = function ( ) {
135
+ $scope . resume = function ( ) {
138
136
resetTimeout ( ) ;
139
137
if ( $scope . countdownattr ) {
140
138
$scope . countdown += 1 ;
@@ -144,21 +142,21 @@ var timerModule = angular.module('timer', [])
144
142
$scope . isRunning = true ;
145
143
} ;
146
144
147
- $scope . stop = $scope . pause = $element [ 0 ] . stop = $element [ 0 ] . pause = function ( ) {
145
+ $scope . stop = $scope . pause = function ( ) {
148
146
var timeoutId = $scope . timeoutId ;
149
147
$scope . clear ( ) ;
150
148
$scope . $emit ( 'timer-stopped' , { timeoutId : timeoutId , millis : $scope . millis , seconds : $scope . seconds , minutes : $scope . minutes , hours : $scope . hours , days : $scope . days } ) ;
151
149
} ;
152
150
153
- $scope . clear = $element [ 0 ] . clear = function ( ) {
151
+ $scope . clear = function ( ) {
154
152
// same as stop but without the event being triggered
155
153
$scope . stoppedTime = moment ( ) ;
156
154
resetTimeout ( ) ;
157
155
$scope . timeoutId = null ;
158
156
$scope . isRunning = false ;
159
157
} ;
160
158
161
- $scope . reset = $element [ 0 ] . reset = function ( ) {
159
+ $scope . reset = function ( ) {
162
160
$scope . startTime = $scope . startTimeAttr ? moment ( $scope . startTimeAttr ) : moment ( ) ;
163
161
$scope . endTime = $scope . endTimeAttr ? moment ( $scope . endTimeAttr ) : null ;
164
162
$scope . countdown = angular . isNumber ( $scope . countdownattr ) && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
@@ -258,7 +256,7 @@ var timerModule = angular.module('timer', [])
258
256
if ( $scope . countdownattr ) {
259
257
$scope . millis = $scope . countdownattr * 1000 ;
260
258
261
- $scope . addCDSeconds = $element [ 0 ] . addCDSeconds = function ( extraSeconds ) {
259
+ $scope . addCDSeconds = function ( extraSeconds ) {
262
260
$scope . countdown += extraSeconds ;
263
261
$scope . $digest ( ) ;
264
262
if ( ! $scope . isRunning ) {
@@ -319,7 +317,7 @@ var timerModule = angular.module('timer', [])
319
317
$scope . $digest ( ) ;
320
318
} , $scope . interval - adjustment ) ;
321
319
322
- $scope . $emit ( 'timer-tick' , { timeoutId : $scope . timeoutId , millis : $scope . millis , timerElement : $element [ 0 ] } ) ;
320
+ $scope . $emit ( 'timer-tick' , { timeoutId : $scope . timeoutId , millis : $scope . millis } ) ;
323
321
324
322
if ( $scope . countdown > 0 ) {
325
323
$scope . countdown -- ;
0 commit comments