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

Function $RootScopeProvider

lib/test/angular/1.8.0/angular.js:18449–19877  ·  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

18447 * {@link guide/scope developer guide on scopes}.
18448 */
18449function $RootScopeProvider() {
18450 var TTL = 10;
18451 var $rootScopeMinErr = minErr('$rootScope');
18452 var lastDirtyWatch = null;
18453 var applyAsyncId = null;
18454
18455 this.digestTtl = function(value) {
18456 if (arguments.length) {
18457 TTL = value;
18458 }
18459 return TTL;
18460 };
18461
18462 function createChildScopeClass(parent) {
18463 function ChildScope() {
18464 this.$$watchers = this.$$nextSibling =
18465 this.$$childHead = this.$$childTail = null;
18466 this.$$listeners = {};
18467 this.$$listenerCount = {};
18468 this.$$watchersCount = 0;
18469 this.$id = nextUid();
18470 this.$$ChildScope = null;
18471 this.$$suspended = false;
18472 }
18473 ChildScope.prototype = parent;
18474 return ChildScope;
18475 }
18476
18477 this.$get = ['$exceptionHandler', '$parse', '$browser',
18478 function($exceptionHandler, $parse, $browser) {
18479
18480 function destroyChildScope($event) {
18481 $event.currentScope.$$destroyed = true;
18482 }
18483
18484 function cleanUpScope($scope) {
18485
18486 // Support: IE 9 only
18487 if (msie === 9) {
18488 // There is a memory leak in IE9 if all child scopes are not disconnected
18489 // completely when a scope is destroyed. So this code will recurse up through
18490 // all this scopes children
18491 //
18492 // See issue https://github.com/angular/angular.js/issues/10706
18493 if ($scope.$$childHead) {
18494 cleanUpScope($scope.$$childHead);
18495 }
18496 if ($scope.$$nextSibling) {
18497 cleanUpScope($scope.$$nextSibling);
18498 }
18499 }
18500
18501 // The code below works around IE9 and V8's memory leaks
18502 //
18503 // See:
18504 // - https://code.google.com/p/v8/issues/detail?id=2073#c26
18505 // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
18506 // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451

Callers

nothing calls this directly

Calls 15

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
fnFunction · 0.70
equalsFunction · 0.70

Tested by

no test coverage detected