aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMisko Hevery2012-09-07 11:14:48 -0700
committerMisko Hevery2012-09-11 16:12:41 -0700
commit331cd5a8cb5efdafe8ad7eb386aed4033cfc1bb3 (patch)
tree6834ecdae81eee6c69fabad67fdb5eb537cfb50f /src
parentf2ebfa16b0849a1ea26f73ae63dcb0e56f066646 (diff)
downloadangular.js-331cd5a8cb5efdafe8ad7eb386aed4033cfc1bb3.tar.bz2
fix($evalAsync): have only one global async queue
Having one async queue per scope complicates the matters when users wish to do partial scope updates, since many services put events on the rootScope. By having single queue the programing model is simplified.
Diffstat (limited to 'src')
-rw-r--r--src/ng/rootScope.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js
index bd712e07..759b4c72 100644
--- a/src/ng/rootScope.js
+++ b/src/ng/rootScope.js
@@ -195,7 +195,6 @@ function $RootScopeProvider(){
child['this'] = child;
child.$$listeners = {};
child.$parent = this;
- child.$$asyncQueue = [];
child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null;
child.$$prevSibling = this.$$childTail;
if (this.$$childHead) {
@@ -362,7 +361,7 @@ function $RootScopeProvider(){
$digest: function() {
var watch, value, last,
watchers,
- asyncQueue,
+ asyncQueue = this.$$asyncQueue,
length,
dirty, ttl = TTL,
next, current, target = this,
@@ -371,18 +370,19 @@ function $RootScopeProvider(){
beginPhase('$digest');
- do {
+ do { // "while dirty" loop
dirty = false;
current = target;
- do {
- asyncQueue = current.$$asyncQueue;
- while(asyncQueue.length) {
- try {
- current.$eval(asyncQueue.shift());
- } catch (e) {
- $exceptionHandler(e);
- }
+
+ while(asyncQueue.length) {
+ try {
+ current.$eval(asyncQueue.shift());
+ } catch (e) {
+ $exceptionHandler(e);
}
+ }
+
+ do { // "traverse the scopes" loop
if ((watchers = current.$$watchers)) {
// process our watches
length = watchers.length;