* @ngdoc service * @name $rootScope * @description * * Every application has a single root ng.$rootScope.Scope scope. * All other scopes are descendant scopes of the root scope. Scopes provide separation * between the model and the view, via a mechanism for watching the model for chang
()
| 15929 | * {@link guide/scope developer guide on scopes}. |
| 15930 | */ |
| 15931 | function $RootScopeProvider() { |
| 15932 | var TTL = 10; |
| 15933 | var $rootScopeMinErr = minErr('$rootScope'); |
| 15934 | var lastDirtyWatch = null; |
| 15935 | var applyAsyncId = null; |
| 15936 | |
| 15937 | this.digestTtl = function(value) { |
| 15938 | if (arguments.length) { |
| 15939 | TTL = value; |
| 15940 | } |
| 15941 | return TTL; |
| 15942 | }; |
| 15943 | |
| 15944 | function createChildScopeClass(parent) { |
| 15945 | function ChildScope() { |
| 15946 | this.$$watchers = this.$$nextSibling = |
| 15947 | this.$$childHead = this.$$childTail = null; |
| 15948 | this.$$listeners = {}; |
| 15949 | this.$$listenerCount = {}; |
| 15950 | this.$$watchersCount = 0; |
| 15951 | this.$id = nextUid(); |
| 15952 | this.$$ChildScope = null; |
| 15953 | } |
| 15954 | ChildScope.prototype = parent; |
| 15955 | return ChildScope; |
| 15956 | } |
| 15957 | |
| 15958 | this.$get = ['$exceptionHandler', '$parse', '$browser', |
| 15959 | function($exceptionHandler, $parse, $browser) { |
| 15960 | |
| 15961 | function destroyChildScope($event) { |
| 15962 | $event.currentScope.$$destroyed = true; |
| 15963 | } |
| 15964 | |
| 15965 | function cleanUpScope($scope) { |
| 15966 | |
| 15967 | if (msie === 9) { |
| 15968 | // There is a memory leak in IE9 if all child scopes are not disconnected |
| 15969 | // completely when a scope is destroyed. So this code will recurse up through |
| 15970 | // all this scopes children |
| 15971 | // |
| 15972 | // See issue https://github.com/angular/angular.js/issues/10706 |
| 15973 | $scope.$$childHead && cleanUpScope($scope.$$childHead); |
| 15974 | $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling); |
| 15975 | } |
| 15976 | |
| 15977 | // The code below works around IE9 and V8's memory leaks |
| 15978 | // |
| 15979 | // See: |
| 15980 | // - https://code.google.com/p/v8/issues/detail?id=2073#c26 |
| 15981 | // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909 |
| 15982 | // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 |
| 15983 | |
| 15984 | $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead = |
| 15985 | $scope.$$childTail = $scope.$root = $scope.$$watchers = null; |
| 15986 | } |
| 15987 | |
| 15988 | /** |
nothing calls this directly
no test coverage detected