1
1
/**
2
- * angular-timer - v1.3.5 - 2017-03-08 6:11 PM
2
+ * angular-timer - v1.3.5 - 2017-03-09 11:42 AM
3
3
* https://github.com/siddii/angular-timer
4
4
*
5
5
* Copyright (c) 2017 Adrian Wardell
@@ -341,8 +341,10 @@ var timerModule = angular.module('timer', [])
341
341
342
342
//We are not using $timeout for a reason. Please read here - https://github.com/siddii/angular-timer/pull/5
343
343
$scope . timeoutId = setTimeout ( function ( ) {
344
- tick ( ) ;
345
- $scope . $digest ( ) ;
344
+ tick ( ) ;
345
+ // since you choose not to use $timeout, at least preserve angular cycle two way data binding
346
+ // by calling $scope.$apply() instead of $scope.$digest()
347
+ $scope . $apply ( ) ;
346
348
} , $scope . interval - adjustment ) ;
347
349
348
350
$scope . $emit ( 'timer-tick' , {
@@ -452,9 +454,8 @@ app.factory('I18nService', function() {
452
454
this . language = this . fallback ;
453
455
}
454
456
455
- // It should be handle by the user's application itself, and not inside the directive
456
- // moment init
457
- // moment.locale(this.language);
457
+ //moment init
458
+ moment . locale ( this . language ) ; // @TODO maybe to remove, it should be handle by the user's application itself, and not inside the directive
458
459
459
460
//human duration init, using it because momentjs does not allow accurate time (
460
461
// momentJS: a few moment ago, human duration : 4 seconds ago
@@ -476,13 +477,13 @@ app.factory('I18nService', function() {
476
477
477
478
if ( typeof this . timeHumanizer != 'undefined' ) {
478
479
time = {
479
- 'millis' : this . timeHumanizer ( diffFromAlarm , { units : [ "ms " ] } ) ,
480
- 'seconds' : this . timeHumanizer ( diffFromAlarm , { units : [ "s " ] } ) ,
481
- 'minutes' : this . timeHumanizer ( diffFromAlarm , { units : [ "m " , "s " ] } ) ,
482
- 'hours' : this . timeHumanizer ( diffFromAlarm , { units : [ "h " , "m " , "s " ] } ) ,
483
- 'days' : this . timeHumanizer ( diffFromAlarm , { units : [ "d " , "h " , "m " , "s " ] } ) ,
484
- 'months' : this . timeHumanizer ( diffFromAlarm , { units : [ "mo " , "d " , "h " , "m " , "s " ] } ) ,
485
- 'years' : this . timeHumanizer ( diffFromAlarm , { units : [ "y " , "mo " , "d " , "h " , "m " , "s " ] } )
480
+ 'millis' : this . timeHumanizer ( diffFromAlarm , { units : [ "milliseconds " ] } ) ,
481
+ 'seconds' : this . timeHumanizer ( diffFromAlarm , { units : [ "seconds " ] } ) ,
482
+ 'minutes' : this . timeHumanizer ( diffFromAlarm , { units : [ "minutes " , "seconds " ] } ) ,
483
+ 'hours' : this . timeHumanizer ( diffFromAlarm , { units : [ "hours " , "minutes " , "seconds " ] } ) ,
484
+ 'days' : this . timeHumanizer ( diffFromAlarm , { units : [ "days " , "hours " , "minutes " , "seconds " ] } ) ,
485
+ 'months' : this . timeHumanizer ( diffFromAlarm , { units : [ "months " , "days " , "hours " , "minutes " , "seconds " ] } ) ,
486
+ 'years' : this . timeHumanizer ( diffFromAlarm , { units : [ "years " , "months " , "days " , "hours " , "minutes " , "seconds " ] } )
486
487
} ;
487
488
}
488
489
else {
0 commit comments