Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9af7a91

Browse files
committed
fix($defer): remove deprecated $defer service
1 parent 74fa65e commit 9af7a91

9 files changed

+6
-176
lines changed

angularFiles.js

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ angularFiles = {
1313
'src/ng/cacheFactory.js',
1414
'src/ng/compile.js',
1515
'src/ng/controller.js',
16-
'src/ng/defer.js',
1716
'src/ng/document.js',
1817
'src/ng/exceptionHandler.js',
1918
'src/ng/interpolate.js',

docs/content/guide/dev_guide.services.managing_dependencies.ngdoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ provided by Angular's web framework:
5050
* @param {*} message Message to be logged.
5151
*/
5252
function batchLogModule($provide){
53-
$provide.factory('batchLog', ['$defer', '$log', function($defer, $log) {
53+
$provide.factory('batchLog', ['$timeout', '$log', function($timeout, $log) {
5454
var messageQueue = [];
5555

5656
function log() {
5757
if (messageQueue.length) {
5858
$log('batchLog messages: ', messageQueue);
5959
messageQueue = [];
6060
}
61-
$defer(log, 50000);
61+
$timeout(log, 50000);
6262
}
6363

6464
// start periodic checking
@@ -88,7 +88,7 @@ provided by Angular's web framework:
8888

8989
Things to notice in this example:
9090

91-
* The `batchLog` service depends on the built-in {@link api/ng.$defer $defer} and
91+
* The `batchLog` service depends on the built-in {@link api/ng.$timeout $timeout} and
9292
{@link api/ng.$log $log} services, and allows messages to be logged into the
9393
`console.log` in batches.
9494
* The `routeTemplateMonitor` service depends on the built-in {@link api/ng.$route

docs/content/guide/scope.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ the `$digest` phase. This delay is desirable, since it coalesces multiple model
259259
api/ng.$rootScope.Scope#$apply scope.$apply()}. (Angular apis do this
260260
implicitly, so no extra `$apply` call is needed when doing synchronous work in controllers,
261261
or asynchronous work with {@link api/ng.$http $http} or {@link
262-
api/ng.$defer $defer} services.
262+
api/ng.$timeout $timeout} services.
263263

264264
4. **Mutation observation**
265265

src/AngularPublic.js

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ function publishExternalAPI(angular){
109109
$browser: $BrowserProvider,
110110
$cacheFactory: $CacheFactoryProvider,
111111
$controller: $ControllerProvider,
112-
$defer: $DeferProvider,
113112
$document: $DocumentProvider,
114113
$exceptionHandler: $ExceptionHandlerProvider,
115114
$filter: $FilterProvider,

src/bootstrap/bootstrap-prettify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ directive.ngEmbedApp = ['$templateCache', '$browser', '$rootScope', '$location',
198198
}];
199199
this.html5Mode = angular.noop;
200200
});
201-
$provide.decorator('$defer', ['$rootScope', '$delegate', function($rootScope, $delegate) {
201+
$provide.decorator('$timeout', ['$rootScope', '$delegate', function($rootScope, $delegate) {
202202
return angular.extend(function(fn, delay) {
203203
if (delay && delay > 50) {
204204
return setTimeout(function() {

src/ng/defer.js

-49
This file was deleted.

src/ngMock/angular-mocks.js

-5
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ angular.mock = {};
2727
*
2828
* The api of this service is the same as that of the real {@link ng.$browser $browser}, except
2929
* that there are several helper methods available which can be used in tests.
30-
*
31-
* The following apis can be used in tests:
32-
*
33-
* - $browser.defer — enables testing of code that uses
34-
* {@link ng.$defer $defer} for executing functions via the `setTimeout` api.
3530
*/
3631
angular.mock.$BrowserProvider = function() {
3732
this.$get = function(){

test/ng/deferSpec.js

-114
This file was deleted.

test/ngMock/angular-mocksSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ describe('ngMockE2E', function() {
989989

990990

991991
describe('autoflush', function() {
992-
it('should flush responses via $defer', inject(function($browser) {
992+
it('should flush responses via $browser.defer', inject(function($browser) {
993993
hb.when('GET', '/foo').respond('bar');
994994
hb('GET', '/foo', null, callback);
995995

0 commit comments

Comments
 (0)