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

Function $RootScopeProvider

test/angular/1.4/angular.js:15495–16793  ·  view source on GitHub ↗

* @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

()

Source from the content-addressed store, hash-verified

15493 * {@link guide/scope developer guide on scopes}.
15494 */
15495function $RootScopeProvider() {
15496 var TTL = 10;
15497 var $rootScopeMinErr = minErr('$rootScope');
15498 var lastDirtyWatch = null;
15499 var applyAsyncId = null;
15500
15501 this.digestTtl = function(value) {
15502 if (arguments.length) {
15503 TTL = value;
15504 }
15505 return TTL;
15506 };
15507
15508 function createChildScopeClass(parent) {
15509 function ChildScope() {
15510 this.$$watchers = this.$$nextSibling =
15511 this.$$childHead = this.$$childTail = null;
15512 this.$$listeners = {};
15513 this.$$listenerCount = {};
15514 this.$$watchersCount = 0;
15515 this.$id = nextUid();
15516 this.$$ChildScope = null;
15517 }
15518 ChildScope.prototype = parent;
15519 return ChildScope;
15520 }
15521
15522 this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
15523 function($injector, $exceptionHandler, $parse, $browser) {
15524
15525 function destroyChildScope($event) {
15526 $event.currentScope.$$destroyed = true;
15527 }
15528
15529 function cleanUpScope($scope) {
15530
15531 if (msie === 9) {
15532 // There is a memory leak in IE9 if all child scopes are not disconnected
15533 // completely when a scope is destroyed. So this code will recurse up through
15534 // all this scopes children
15535 //
15536 // See issue https://github.com/angular/angular.js/issues/10706
15537 $scope.$$childHead && cleanUpScope($scope.$$childHead);
15538 $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);
15539 }
15540
15541 // The code below works around IE9 and V8's memory leaks
15542 //
15543 // See:
15544 // - https://code.google.com/p/v8/issues/detail?id=2073#c26
15545 // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
15546 // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
15547
15548 $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =
15549 $scope.$$childTail = $scope.$root = $scope.$$watchers = null;
15550 }
15551
15552 /**

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