| 
									
										
										
										
											2016-06-23 09:47:54 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-01 14:05:19 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |  * The strategy that the default change detector uses to detect changes. | 
					
						
							|  |  |  |  * When set, takes effect the next time change detection is triggered. | 
					
						
							| 
									
										
										
										
											2018-04-05 22:31:44 +01:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2018-10-19 16:27:04 +01:00
										 |  |  |  * @publicApi | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-06-27 20:00:30 -07:00
										 |  |  | export enum ChangeDetectionStrategy { | 
					
						
							| 
									
										
										
										
											2015-10-27 10:55:01 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * Use the `CheckOnce` strategy, meaning that automatic change detection is deactivated | 
					
						
							|  |  |  |    * until reactivated by setting the strategy to `Default` (`CheckAlways`). | 
					
						
							| 
									
										
										
										
											2018-12-21 13:55:47 +01:00
										 |  |  |    * Change detection can still be explicitly invoked. | 
					
						
							| 
									
										
										
										
											2015-10-27 10:55:01 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2017-08-16 09:00:03 -07:00
										 |  |  |   OnPush = 0, | 
					
						
							| 
									
										
										
										
											2015-10-27 10:55:01 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * Use the default `CheckAlways` strategy, in which change detection is automatic until | 
					
						
							|  |  |  |    * explicitly deactivated. | 
					
						
							| 
									
										
										
										
											2015-10-27 10:55:01 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2017-08-16 09:00:03 -07:00
										 |  |  |   Default = 1, | 
					
						
							| 
									
										
										
										
											2015-10-27 10:55:01 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |  * Defines the possible states of the default change detector. | 
					
						
							|  |  |  |  * @see `ChangeDetectorRef` | 
					
						
							| 
									
										
										
										
											2015-12-03 15:49:09 -08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-06-27 20:00:30 -07:00
										 |  |  | export enum ChangeDetectorStatus { | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * A state in which, after calling `detectChanges()`, the change detector | 
					
						
							|  |  |  |    * state becomes `Checked`, and must be explicitly invoked or reactivated. | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  |    */ | 
					
						
							|  |  |  |   CheckOnce, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * A state in which change detection is skipped until the change detector mode | 
					
						
							|  |  |  |    * becomes `CheckOnce`. | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  |    */ | 
					
						
							|  |  |  |   Checked, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2018-12-21 13:55:47 +01:00
										 |  |  |    * A state in which change detection continues automatically until explicitly | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * deactivated. | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  |    */ | 
					
						
							|  |  |  |   CheckAlways, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * A state in which a change detector sub tree is not a part of the main tree and | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  |    * should be skipped. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   Detached, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * Indicates that the change detector encountered an error checking a binding | 
					
						
							| 
									
										
										
										
											2016-06-27 20:00:30 -07:00
										 |  |  |    * or calling a directive lifecycle method and is now in an inconsistent state. Change | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * detectors in this state do not detect changes. | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2016-06-27 20:00:30 -07:00
										 |  |  |   Errored, | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |    * Indicates that the change detector has been destroyed. | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2016-06-27 20:00:30 -07:00
										 |  |  |   Destroyed, | 
					
						
							| 
									
										
										
										
											2015-08-21 14:45:38 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Reports whether a given strategy is currently the default for change detection. | 
					
						
							|  |  |  |  * @param changeDetectionStrategy The strategy to check. | 
					
						
							|  |  |  |  * @returns True if the given strategy is the current default, false otherwise. | 
					
						
							|  |  |  |  * @see `ChangeDetectorStatus` | 
					
						
							| 
									
										
										
										
											2018-10-19 16:27:04 +01:00
										 |  |  |  * @see `ChangeDetectorRef` | 
					
						
							| 
									
										
										
										
											2018-07-02 12:06:52 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | export function isDefaultChangeDetectionStrategy(changeDetectionStrategy: ChangeDetectionStrategy): | 
					
						
							|  |  |  |     boolean { | 
					
						
							| 
									
										
										
										
											2017-03-02 09:37:01 -08:00
										 |  |  |   return changeDetectionStrategy == null || | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  |       changeDetectionStrategy === ChangeDetectionStrategy.Default; | 
					
						
							| 
									
										
										
										
											2015-08-26 11:44:59 -07:00
										 |  |  | } |