all files / app/animation/ animationTimers.service.js

100% Statements 7/7
100% Branches 0/0
100% Functions 5/5
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58                        84×                                                           21×                    
/**
 * @ngdoc service
 * @name app.animation.animationTimers
 * @description
 * Provide delays when animating visual elements, like forms.
 */
(function () {
  'use strict';
 
  angular
    .module('app.animation')
    .factory('animationTimers', factory);
 
  /** @ngInject */
  function factory($timeout, animationIntervals) {
    return {
      /**
       * @ngdoc function
       * @name delayIn
       * @methodOf app.animation.animationTimers
       * @description
       * Delay while showing elements.
       * @returns {Object} a promise.
      */
      delayIn: function() {
        return $timeout(animationIntervals.in);
      },
      /**
       * @ngdoc function
       * @name delayOut
       * @methodOf app.animation.animationTimers
       * @description
       * Delay while hiding elements.
       * @returns {Object} a promise.
       */     
      delayOut: function() {
        return $timeout(animationIntervals.out);
      },
      /**
       * @ngdoc function
       * @name digest
       * @methodOf app.animation.animationTimers
       * @description
       * Allow evaulation of ng-class before hiding or showing elements.
       * @returns {Object} a promise.
       */
      digest: function() {
        return $timeout(0);
      }
    };
 
  }
})();