diff options
| author | Igor Minar | 2012-05-22 23:05:26 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-05-23 15:00:56 -0700 |
| commit | 4511d39cc748288df70bdc258f98a8f36652e683 (patch) | |
| tree | 17402bb4910b12c4b1a38778309a62addd2c947f /src/ng/defer.js | |
| parent | 15b8f205bb4e9797608ce440075e5149db6e6d45 (diff) | |
| download | angular.js-4511d39cc748288df70bdc258f98a8f36652e683.tar.bz2 | |
feat($timeout): add $timeout service that supersedes $defer
$timeout has a better name ($defer got often confused with something related to $q) and
is actually promise based with cancelation support.
With this commit the $defer service is deprecated and will be removed before 1.0.
Closes #704, #532
Diffstat (limited to 'src/ng/defer.js')
| -rw-r--r-- | src/ng/defer.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ng/defer.js b/src/ng/defer.js index f2a893bc..b5dc8844 100644 --- a/src/ng/defer.js +++ b/src/ng/defer.js @@ -3,6 +3,8 @@ /** * @ngdoc function * @name angular.module.ng.$defer + * @deprecated Made obsolete by $timeout service. Please migrate your code. This service will be + * removed with 1.0 final. * @requires $browser * * @description @@ -29,7 +31,9 @@ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfuly canceled. */ function $DeferProvider(){ - this.$get = ['$rootScope', '$browser', function($rootScope, $browser) { + this.$get = ['$rootScope', '$browser', '$log', function($rootScope, $browser, $log) { + $log.warn('$defer service has been deprecated, migrate to $timeout'); + function defer(fn, delay) { return $browser.defer(function() { $rootScope.$apply(fn); |
