@@ -130,11 +130,8 @@ function $RootScopeProvider(){
130
130
this . $$childHead = this . $$childTail = null ;
131
131
this [ 'this' ] = 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.
@@ -693,8 +687,6 @@ function $RootScopeProvider(){
693
687
$digest : function ( ) {
694
688
var watch , value , last ,
695
689
watchers ,
696
- asyncQueue = this . $$asyncQueue ,
697
- postDigestQueue = this . $$postDigestQueue ,
698
690
length ,
699
691
dirty , ttl = TTL ,
700
692
next , current , target = this ,
@@ -871,9 +863,6 @@ function $RootScopeProvider(){
871
863
this . $parent = this . $$nextSibling = this . $$prevSibling = this . $$childHead =
872
864
this . $$childTail = this . $root = this . $$watchers = this . $$listeners = null ;
873
865
874
- // don't reset these to null in case some async task tries to register a listener/watch/task
875
- this . $$asyncQueue = this . $$postDigestQueue = [ ] ;
876
-
877
866
// prevent NPEs since these methods have references to properties we nulled out
878
867
this . $destroy = this . $digest = this . $apply = noop ;
879
868
this . $on = this . $watch = this . $watchGroup = function ( ) { return noop ; } ;
@@ -943,19 +932,19 @@ function $RootScopeProvider(){
943
932
$evalAsync : function ( expr ) {
944
933
// if we are outside of an $digest loop and this is the first time we are scheduling async
945
934
// task also schedule async auto-flush
946
- if ( ! $rootScope . $$phase && ! $rootScope . $$ asyncQueue. length ) {
935
+ if ( ! $rootScope . $$phase && ! asyncQueue . length ) {
947
936
$browser . defer ( function ( ) {
948
- if ( $rootScope . $$ asyncQueue. length ) {
937
+ if ( asyncQueue . length ) {
949
938
$rootScope . $digest ( ) ;
950
939
}
951
940
} ) ;
952
941
}
953
942
954
- this . $$ asyncQueue. push ( { scope : this , expression : expr } ) ;
943
+ asyncQueue . push ( { scope : this , expression : expr } ) ;
955
944
} ,
956
945
957
946
$$postDigest : function ( fn ) {
958
- this . $$ postDigestQueue. push ( fn ) ;
947
+ postDigestQueue . push ( fn ) ;
959
948
} ,
960
949
961
950
/**
@@ -1039,7 +1028,7 @@ function $RootScopeProvider(){
1039
1028
*/
1040
1029
$applyAsync : function ( expr ) {
1041
1030
var scope = this ;
1042
- expr && $rootScope . $$ applyAsyncQueue. push ( $applyAsyncExpression ) ;
1031
+ expr && applyAsyncQueue . push ( $applyAsyncExpression ) ;
1043
1032
scheduleApplyAsync ( ) ;
1044
1033
1045
1034
function $applyAsyncExpression ( ) {
@@ -1251,6 +1240,10 @@ function $RootScopeProvider(){
1251
1240
1252
1241
var $rootScope = new Scope ( ) ;
1253
1242
1243
+ var asyncQueue = [ ] ;
1244
+ var postDigestQueue = [ ] ;
1245
+ var applyAsyncQueue = [ ] ;
1246
+
1254
1247
return $rootScope ;
1255
1248
1256
1249
@@ -1284,10 +1277,9 @@ function $RootScopeProvider(){
1284
1277
function initWatchVal ( ) { }
1285
1278
1286
1279
function flushApplyAsync ( ) {
1287
- var queue = $rootScope . $$applyAsyncQueue ;
1288
- while ( queue . length ) {
1280
+ while ( applyAsyncQueue . length ) {
1289
1281
try {
1290
- queue . shift ( ) ( ) ;
1282
+ applyAsyncQueue . shift ( ) ( ) ;
1291
1283
} catch ( e ) {
1292
1284
$exceptionHandler ( e ) ;
1293
1285
}
0 commit comments