@this
()
| 13292 | |
| 13293 | /** @this */ |
| 13294 | function $IntervalProvider() { |
| 13295 | this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser', |
| 13296 | function($rootScope, $window, $q, $$q, $browser) { |
| 13297 | var intervals = {}; |
| 13298 | |
| 13299 | |
| 13300 | /** |
| 13301 | * @ngdoc service |
| 13302 | * @name $interval |
| 13303 | * |
| 13304 | * @description |
| 13305 | * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay` |
| 13306 | * milliseconds. |
| 13307 | * |
| 13308 | * The return value of registering an interval function is a promise. This promise will be |
| 13309 | * notified upon each tick of the interval, and will be resolved after `count` iterations, or |
| 13310 | * run indefinitely if `count` is not defined. The value of the notification will be the |
| 13311 | * number of iterations that have run. |
| 13312 | * To cancel an interval, call `$interval.cancel(promise)`. |
| 13313 | * |
| 13314 | * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to |
| 13315 | * move forward by `millis` milliseconds and trigger any functions scheduled to run in that |
| 13316 | * time. |
| 13317 | * |
| 13318 | * <div class="alert alert-warning"> |
| 13319 | * **Note**: Intervals created by this service must be explicitly destroyed when you are finished |
| 13320 | * with them. In particular they are not automatically destroyed when a controller's scope or a |
| 13321 | * directive's element are destroyed. |
| 13322 | * You should take this into consideration and make sure to always cancel the interval at the |
| 13323 | * appropriate moment. See the example below for more details on how and when to do this. |
| 13324 | * </div> |
| 13325 | * |
| 13326 | * @param {function()} fn A function that should be called repeatedly. If no additional arguments |
| 13327 | * are passed (see below), the function is called with the current iteration count. |
| 13328 | * @param {number} delay Number of milliseconds between each function call. |
| 13329 | * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat |
| 13330 | * indefinitely. |
| 13331 | * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise |
| 13332 | * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. |
| 13333 | * @param {...*=} Pass additional parameters to the executed function. |
| 13334 | * @returns {promise} A promise which will be notified on each iteration. It will resolve once all iterations of the interval complete. |
| 13335 | * |
| 13336 | * @example |
| 13337 | * <example module="intervalExample" name="interval-service"> |
| 13338 | * <file name="index.html"> |
| 13339 | * <script> |
| 13340 | * angular.module('intervalExample', []) |
| 13341 | * .controller('ExampleController', ['$scope', '$interval', |
| 13342 | * function($scope, $interval) { |
| 13343 | * $scope.format = 'M/d/yy h:mm:ss a'; |
| 13344 | * $scope.blood_1 = 100; |
| 13345 | * $scope.blood_2 = 120; |
| 13346 | * |
| 13347 | * var stop; |
| 13348 | * $scope.fight = function() { |
| 13349 | * // Don't start a new fight if we are already fighting |
| 13350 | * if ( angular.isDefined(stop) ) return; |
| 13351 | * |
nothing calls this directly
no test coverage detected