feat(ivy): support markForCheck (#22690)

PR Close #22690
This commit is contained in:
Kara Erickson
2018-03-09 12:45:31 -08:00
parent 0d8deb0795
commit fa451bcd19
4 changed files with 327 additions and 18 deletions

View File

@ -11,7 +11,11 @@
*/
export abstract class ChangeDetectorRef {
/**
* Marks all {@link ChangeDetectionStrategy#OnPush OnPush} ancestors as to be checked.
* Marks a view and all of its ancestors dirty.
*
* This can be used to ensure an {@link ChangeDetectionStrategy#OnPush OnPush} component is
* checked when it needs to be re-rendered but the two normal triggers haven't marked it
* dirty (i.e. inputs haven't changed and events haven't fired in the view).
*
* <!-- TODO: Add a link to a chapter on OnPush components -->
*
@ -39,12 +43,12 @@ export abstract class ChangeDetectorRef {
abstract markForCheck(): void;
/**
* Detaches the change detector from the change detector tree.
* Detaches the view from the change detection tree.
*
* The detached change detector will not be checked until it is reattached.
*
* This can also be used in combination with {@link ChangeDetectorRef#detectChanges detectChanges}
* to implement local change detection checks.
* Detached views will not be checked during change detection runs until they are
* re-attached, even if they are dirty. `detach` can be used in combination with
* {@link ChangeDetectorRef#detectChanges detectChanges} to implement local change
* detection checks.
*
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
* <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
@ -93,7 +97,7 @@ export abstract class ChangeDetectorRef {
abstract detach(): void;
/**
* Checks the change detector and its children.
* Checks the view and its children.
*
* This can also be used in combination with {@link ChangeDetectorRef#detach detach} to implement
* local change detection checks.
@ -108,8 +112,7 @@ export abstract class ChangeDetectorRef {
* we want to check and update the list every five seconds.
*
* We can do that by detaching the component's change detector and doing a local change detection
* check
* every five seconds.
* check every five seconds.
*
* See {@link ChangeDetectorRef#detach detach} for more information.
*/
@ -124,7 +127,10 @@ export abstract class ChangeDetectorRef {
abstract checkNoChanges(): void;
/**
* Reattach the change detector to the change detector tree.
* Re-attaches the view to the change detection tree.
*
* This can be used to re-attach views that were previously detached from the tree
* using {@link ChangeDetectorRef#detach detach}. Views are attached to the tree by default.
*
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
*