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

Function $RootScopeProvider

lib/test/angular/1.7.0/angular.js:17804–19232  ·  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

17802 * {@link guide/scope developer guide on scopes}.
17803 */
17804function $RootScopeProvider() {
17805 var TTL = 10;
17806 var $rootScopeMinErr = minErr('$rootScope');
17807 var lastDirtyWatch = null;
17808 var applyAsyncId = null;
17809
17810 this.digestTtl = function(value) {
17811 if (arguments.length) {
17812 TTL = value;
17813 }
17814 return TTL;
17815 };
17816
17817 function createChildScopeClass(parent) {
17818 function ChildScope() {
17819 this.$$watchers = this.$$nextSibling =
17820 this.$$childHead = this.$$childTail = null;
17821 this.$$listeners = {};
17822 this.$$listenerCount = {};
17823 this.$$watchersCount = 0;
17824 this.$id = nextUid();
17825 this.$$ChildScope = null;
17826 this.$$suspended = false;
17827 }
17828 ChildScope.prototype = parent;
17829 return ChildScope;
17830 }
17831
17832 this.$get = ['$exceptionHandler', '$parse', '$browser',
17833 function($exceptionHandler, $parse, $browser) {
17834
17835 function destroyChildScope($event) {
17836 $event.currentScope.$$destroyed = true;
17837 }
17838
17839 function cleanUpScope($scope) {
17840
17841 // Support: IE 9 only
17842 if (msie === 9) {
17843 // There is a memory leak in IE9 if all child scopes are not disconnected
17844 // completely when a scope is destroyed. So this code will recurse up through
17845 // all this scopes children
17846 //
17847 // See issue https://github.com/angular/angular.js/issues/10706
17848 if ($scope.$$childHead) {
17849 cleanUpScope($scope.$$childHead);
17850 }
17851 if ($scope.$$nextSibling) {
17852 cleanUpScope($scope.$$nextSibling);
17853 }
17854 }
17855
17856 // The code below works around IE9 and V8's memory leaks
17857 //
17858 // See:
17859 // - https://code.google.com/p/v8/issues/detail?id=2073#c26
17860 // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
17861 // - 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