@@ -130,11 +130,8 @@ function $RootScopeProvider(){
130
130
this.$$childHead = this.$$childTail = null;
131
131
this.$root = this;
132
132
this.$$destroyed = false;
133
- this.$$asyncQueue = [];
134
- this.$$postDigestQueue = [];
135
133
this.$$listeners = this.$$listenerCount = null;
136
134
this.$$isolateBindings = null;
137
- this.$$applyAsyncQueue = [];
138
135
}
139
136
140
137
/**
@@ -192,9 +189,6 @@ function $RootScopeProvider(){
192
189
if (isolate) {
193
190
child = new Scope();
194
191
child.$root = this.$root;
195
- // ensure that there is just one async queue per $rootScope and its children
196
- child.$$asyncQueue = this.$$asyncQueue;
197
- child.$$postDigestQueue = this.$$postDigestQueue;
198
192
} else {
199
193
// Only create a child scope class if somebody asks for one,
200
194
// but cache it to allow the VM to optimize lookups.
@@ -692,8 +686,6 @@ function $RootScopeProvider(){
692
686
$digest: function() {
693
687
var watch, value, last,
694
688
watchers,
695
- asyncQueue = this.$$asyncQueue,
696
- postDigestQueue = this.$$postDigestQueue,
697
689
length,
698
690
dirty, ttl = TTL,
699
691
next, current, target = this,
@@ -870,9 +862,6 @@ function $RootScopeProvider(){
870
862
this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
871
863
this.$$childTail = this.$root = this.$$watchers = this.$$listeners = null;
872
864
873
- // don't reset these to null in case some async task tries to register a listener/watch/task
874
- this.$$asyncQueue = this.$$postDigestQueue = [];
875
-
876
865
// prevent NPEs since these methods have references to properties we nulled out
877
866
this.$destroy = this.$digest = this.$apply = noop;
878
867
this.$on = this.$watch = this.$watchGroup = function() { return noop; };
@@ -942,19 +931,19 @@ function $RootScopeProvider(){
942
931
$evalAsync: function(expr) {
943
932
// if we are outside of an $digest loop and this is the first time we are scheduling async
944
933
// task also schedule async auto-flush
945
- if (!$rootScope.$$phase && !$rootScope.$$ asyncQueue.length) {
934
+ if (!$rootScope.$$phase && !asyncQueue.length) {
946
935
$browser.defer(function() {
947
- if ($rootScope.$$ asyncQueue.length) {
936
+ if (asyncQueue.length) {
948
937
$rootScope.$digest();
949
938
}
950
939
});
951
940
}
952
941
953
- this.$$ asyncQueue.push({scope: this, expression: expr});
942
+ asyncQueue.push({scope: this, expression: expr});
954
943
},
955
944
956
945
$$postDigest : function(fn) {
957
- this.$$ postDigestQueue.push(fn);
946
+ postDigestQueue.push(fn);
958
947
},
959
948
960
949
/**
@@ -1038,7 +1027,7 @@ function $RootScopeProvider(){
1038
1027
*/
1039
1028
$applyAsync: function(expr) {
1040
1029
var scope = this;
1041
- expr && $rootScope.$$ applyAsyncQueue.push($applyAsyncExpression);
1030
+ expr && applyAsyncQueue.push($applyAsyncExpression);
1042
1031
scheduleApplyAsync();
1043
1032
1044
1033
function $applyAsyncExpression() {
@@ -1250,6 +1239,10 @@ function $RootScopeProvider(){
1250
1239
1251
1240
var $rootScope = new Scope();
1252
1241
1242
+ var asyncQueue = [];
1243
+ var postDigestQueue = [];
1244
+ var applyAsyncQueue = [];
1245
+
1253
1246
return $rootScope;
1254
1247
1255
1248
@@ -1283,10 +1276,9 @@ function $RootScopeProvider(){
1283
1276
function initWatchVal() {}
1284
1277
1285
1278
function flushApplyAsync() {
1286
- var queue = $rootScope.$$applyAsyncQueue;
1287
- while (queue.length) {
1279
+ while (applyAsyncQueue.length) {
1288
1280
try {
1289
- queue .shift()();
1281
+ applyAsyncQueue .shift()();
1290
1282
} catch(e) {
1291
1283
$exceptionHandler(e);
1292
1284
}
0 commit comments