angular/angular.js — pull request #7548 by vnesterovsky (2014-05-22 14:14:09+00:00)
Title: Make $digest async

We think it's important to lesser the stress on $digest in angular, thus
we suggest to refactor $digest implementation, and make it asynchronous.
With this in mind we've introduced several changes in my branch.

1. $q service is extended with several methods to support building of asynchronous algorithms.
These are:
promise.thenIf();
promise.thenWhile();
promise.thenDoWhile();
promise.thenForEach();
promise.thenFor();
$q.run();

In theory we would prefer to refactor this service more greatly but we decided to introduce minimal additions there.

2. Introduces $scheduler service that provides:
a) nextTick() a implementation to runs deferred objects in batches until they fit in a time slot, and
then continue the remaining part after some sleep;
b) q factory;

3. rootScope's $digest(), $watchCollection(), and ngRepeater's watch action logics are refactored.

4. schedulerSpec, and asyncDigestSpec tests are created.
Some other tests are fixed.

5. rootScopeProvider has asyncDigest property (false is default) to preserve backward compatibility.