11/**
2- * angular-timer - v1.3.5 - 2017-03-08 6:11 PM
2+ * angular-timer - v1.3.5 - 2017-03-09 11:42 AM
33 * https://github.com/siddii/angular-timer
44 *
55 * Copyright (c) 2017 Adrian Wardell
@@ -341,8 +341,10 @@ var timerModule = angular.module('timer', [])
341341
342342 //We are not using $timeout for a reason. Please read here - https://github.com/siddii/angular-timer/pull/5
343343 $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 ( ) ;
346348 } , $scope . interval - adjustment ) ;
347349
348350 $scope . $emit ( 'timer-tick' , {
@@ -452,9 +454,8 @@ app.factory('I18nService', function() {
452454 this . language = this . fallback ;
453455 }
454456
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
458459
459460 //human duration init, using it because momentjs does not allow accurate time (
460461 // momentJS: a few moment ago, human duration : 4 seconds ago
@@ -476,13 +477,13 @@ app.factory('I18nService', function() {
476477
477478 if ( typeof this . timeHumanizer != 'undefined' ) {
478479 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 " ] } )
486487 } ;
487488 }
488489 else {
0 commit comments