MCPcopy
hub / github.com/angular-ui/ui-router / $RootScopeProvider

Function $RootScopeProvider

test/angular/1.6/angular.js:17760–19212  ·  view source on GitHub ↗

* @ngdoc service * @name $rootScope * @this * * @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 mod

()

Source from the content-addressed store, hash-verified

17758 * {@link guide/scope developer guide on scopes}.
17759 */
17760function $RootScopeProvider() {
17761 var TTL = 10;
17762 var $rootScopeMinErr = minErr('$rootScope');
17763 var lastDirtyWatch = null;
17764 var applyAsyncId = null;
17765
17766 this.digestTtl = function(value) {
17767 if (arguments.length) {
17768 TTL = value;
17769 }
17770 return TTL;
17771 };
17772
17773 function createChildScopeClass(parent) {
17774 function ChildScope() {
17775 this.$$watchers = this.$$nextSibling =
17776 this.$$childHead = this.$$childTail = null;
17777 this.$$listeners = {};
17778 this.$$listenerCount = {};
17779 this.$$watchersCount = 0;
17780 this.$id = nextUid();
17781 this.$$ChildScope = null;
17782 this.$$suspended = false;
17783 }
17784 ChildScope.prototype = parent;
17785 return ChildScope;
17786 }
17787
17788 this.$get = ['$exceptionHandler', '$parse', '$browser',
17789 function($exceptionHandler, $parse, $browser) {
17790
17791 function destroyChildScope($event) {
17792 $event.currentScope.$$destroyed = true;
17793 }
17794
17795 function cleanUpScope($scope) {
17796
17797 // Support: IE 9 only
17798 if (msie === 9) {
17799 // There is a memory leak in IE9 if all child scopes are not disconnected
17800 // completely when a scope is destroyed. So this code will recurse up through
17801 // all this scopes children
17802 //
17803 // See issue https://github.com/angular/angular.js/issues/10706
17804 if ($scope.$$childHead) {
17805 cleanUpScope($scope.$$childHead);
17806 }
17807 if ($scope.$$nextSibling) {
17808 cleanUpScope($scope.$$nextSibling);
17809 }
17810 }
17811
17812 // The code below works around IE9 and V8's memory leaks
17813 //
17814 // See:
17815 // - https://code.google.com/p/v8/issues/detail?id=2073#c26
17816 // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
17817 // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451

Callers

nothing calls this directly

Calls 15

fnFunction · 0.85
minErrFunction · 0.70
createChildScopeClassFunction · 0.70
$parseFunction · 0.70
isFunctionFunction · 0.70
incrementWatchersCountFunction · 0.70
arrayRemoveFunction · 0.70
listenerFunction · 0.70
forEachFunction · 0.70
beginPhaseFunction · 0.70
flushApplyAsyncFunction · 0.70
equalsFunction · 0.70

Tested by

no test coverage detected