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

Commit

Permalink
fix($defer): remove deprecated $defer service
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Jun 12, 2012
1 parent 74fa65e commit 9af7a91
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 176 deletions.
1 change: 0 additions & 1 deletion angularFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ angularFiles = {
'src/ng/cacheFactory.js',
'src/ng/compile.js',
'src/ng/controller.js',
'src/ng/defer.js',
'src/ng/document.js',
'src/ng/exceptionHandler.js',
'src/ng/interpolate.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ provided by Angular's web framework:
* @param {*} message Message to be logged.
*/
function batchLogModule($provide){
$provide.factory('batchLog', ['$defer', '$log', function($defer, $log) {
$provide.factory('batchLog', ['$timeout', '$log', function($timeout, $log) {
var messageQueue = [];

function log() {
if (messageQueue.length) {
$log('batchLog messages: ', messageQueue);
messageQueue = [];
}
$defer(log, 50000);
$timeout(log, 50000);
}

// start periodic checking
Expand Down Expand Up @@ -88,7 +88,7 @@ provided by Angular's web framework:

Things to notice in this example:

* The `batchLog` service depends on the built-in {@link api/ng.$defer $defer} and
* The `batchLog` service depends on the built-in {@link api/ng.$timeout $timeout} and
{@link api/ng.$log $log} services, and allows messages to be logged into the
`console.log` in batches.
* The `routeTemplateMonitor` service depends on the built-in {@link api/ng.$route
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/scope.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ the `$digest` phase. This delay is desirable, since it coalesces multiple model
api/ng.$rootScope.Scope#$apply scope.$apply()}. (Angular apis do this
implicitly, so no extra `$apply` call is needed when doing synchronous work in controllers,
or asynchronous work with {@link api/ng.$http $http} or {@link
api/ng.$defer $defer} services.
api/ng.$timeout $timeout} services.

4. **Mutation observation**

Expand Down
1 change: 0 additions & 1 deletion src/AngularPublic.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ function publishExternalAPI(angular){
$browser: $BrowserProvider,
$cacheFactory: $CacheFactoryProvider,
$controller: $ControllerProvider,
$defer: $DeferProvider,
$document: $DocumentProvider,
$exceptionHandler: $ExceptionHandlerProvider,
$filter: $FilterProvider,
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap-prettify.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ directive.ngEmbedApp = ['$templateCache', '$browser', '$rootScope', '$location',
}];
this.html5Mode = angular.noop;
});
$provide.decorator('$defer', ['$rootScope', '$delegate', function($rootScope, $delegate) {
$provide.decorator('$timeout', ['$rootScope', '$delegate', function($rootScope, $delegate) {
return angular.extend(function(fn, delay) {
if (delay && delay > 50) {
return setTimeout(function() {
Expand Down
49 changes: 0 additions & 49 deletions src/ng/defer.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/ngMock/angular-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ angular.mock = {};
*
* The api of this service is the same as that of the real {@link ng.$browser $browser}, except
* that there are several helper methods available which can be used in tests.
*
* The following apis can be used in tests:
*
* - $browser.defer — enables testing of code that uses
* {@link ng.$defer $defer} for executing functions via the `setTimeout` api.
*/
angular.mock.$BrowserProvider = function() {
this.$get = function(){
Expand Down
114 changes: 0 additions & 114 deletions test/ng/deferSpec.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/ngMock/angular-mocksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ describe('ngMockE2E', function() {


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

Expand Down

0 comments on commit 9af7a91

Please sign in to comment.