Skip to content
Permalink
Browse files

fix($defer): remove deprecated $defer service

  • Loading branch information
IgorMinar committed Jun 12, 2012
1 parent 74fa65e commit 9af7a9198e2d30608ea6c40eedde03e44a6ef569
@@ -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',
@@ -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
@@ -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
@@ -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**

@@ -109,7 +109,6 @@ function publishExternalAPI(angular){
$browser: $BrowserProvider,
$cacheFactory: $CacheFactoryProvider,
$controller: $ControllerProvider,
$defer: $DeferProvider,
$document: $DocumentProvider,
$exceptionHandler: $ExceptionHandlerProvider,
$filter: $FilterProvider,
@@ -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() {

This file was deleted.

@@ -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(){

This file was deleted.

@@ -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);

0 comments on commit 9af7a91

Please sign in to comment.
You can’t perform that action at this time.