2016-06-23 12:47:54 -04: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 17:05:19 -04:00
|
|
|
|
2015-12-03 18:49:09 -05:00
|
|
|
/**
|
2016-06-27 23:00:30 -04:00
|
|
|
* Describes within the change detector which strategy will be used the next time change
|
|
|
|
* detection is triggered.
|
|
|
|
* @stable
|
2015-12-03 18:49:09 -05:00
|
|
|
*/
|
2016-06-27 23:00:30 -04:00
|
|
|
export enum ChangeDetectionStrategy {
|
2015-10-27 13:55:01 -04:00
|
|
|
/**
|
2016-06-27 23:00:30 -04:00
|
|
|
* `OnPush` means that the change detector's mode will be set to `CheckOnce` during hydration.
|
2015-10-27 13:55:01 -04:00
|
|
|
*/
|
2017-08-16 12:00:03 -04:00
|
|
|
OnPush = 0,
|
2015-10-27 13:55:01 -04:00
|
|
|
|
|
|
|
/**
|
2016-06-27 23:00:30 -04:00
|
|
|
* `Default` means that the change detector's mode will be set to `CheckAlways` during hydration.
|
2015-10-27 13:55:01 -04:00
|
|
|
*/
|
2017-08-16 12:00:03 -04:00
|
|
|
Default = 1,
|
2015-10-27 13:55:01 -04:00
|
|
|
}
|
|
|
|
|
2015-12-03 18:49:09 -05:00
|
|
|
/**
|
2016-06-27 23:00:30 -04:00
|
|
|
* Describes the status of the detector.
|
2015-12-03 18:49:09 -05:00
|
|
|
*/
|
2016-06-27 23:00:30 -04:00
|
|
|
export enum ChangeDetectorStatus {
|
2015-08-26 14:44:59 -04:00
|
|
|
/**
|
2016-11-03 14:23:20 -04:00
|
|
|
* `CheckOnce` means that after calling detectChanges the mode of the change detector
|
2015-08-26 14:44:59 -04:00
|
|
|
* will become `Checked`.
|
|
|
|
*/
|
|
|
|
CheckOnce,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* `Checked` means that the change detector should be skipped until its mode changes to
|
|
|
|
* `CheckOnce`.
|
|
|
|
*/
|
|
|
|
Checked,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* `CheckAlways` means that after calling detectChanges the mode of the change detector
|
|
|
|
* will remain `CheckAlways`.
|
|
|
|
*/
|
|
|
|
CheckAlways,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* `Detached` means that the change detector sub tree is not a part of the main tree and
|
|
|
|
* should be skipped.
|
|
|
|
*/
|
|
|
|
Detached,
|
|
|
|
|
|
|
|
/**
|
2016-06-27 23:00:30 -04:00
|
|
|
* `Errored` means that the change detector encountered an error checking a binding
|
|
|
|
* or calling a directive lifecycle method and is now in an inconsistent state. Change
|
|
|
|
* detectors in this state will no longer detect changes.
|
2015-08-26 14:44:59 -04:00
|
|
|
*/
|
2016-06-27 23:00:30 -04:00
|
|
|
Errored,
|
2015-08-26 14:44:59 -04:00
|
|
|
|
|
|
|
/**
|
2016-06-27 23:00:30 -04:00
|
|
|
* `Destroyed` means that the change detector is destroyed.
|
2015-08-26 14:44:59 -04:00
|
|
|
*/
|
2016-06-27 23:00:30 -04:00
|
|
|
Destroyed,
|
2015-08-21 17:45:38 -04:00
|
|
|
}
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
export function isDefaultChangeDetectionStrategy(changeDetectionStrategy: ChangeDetectionStrategy):
|
|
|
|
boolean {
|
2017-03-02 12:37:01 -05:00
|
|
|
return changeDetectionStrategy == null ||
|
2016-06-08 19:38:52 -04:00
|
|
|
changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
2015-08-26 14:44:59 -04:00
|
|
|
}
|