refactor(ChandeDetection): Rename ChangeDetectorRef.markForCheck
BREAKING CHANGE Closes #3403 - ChangeDetectorRef.requestCheck() => ChangeDetectorRef.markForCheck()
This commit is contained in:

committed by
Miško Hevery

parent
b8be4bfaaf
commit
cebd670a8e
@ -220,11 +220,11 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||
this._createArrayToStoreObservables();
|
||||
if (isBlank(this.subscriptions[index])) {
|
||||
this.streams[index] = value.changes;
|
||||
this.subscriptions[index] = value.changes.listen((_) => this.ref.requestCheck());
|
||||
this.subscriptions[index] = value.changes.listen((_) => this.ref.markForCheck());
|
||||
} else if (this.streams[index] !== value.changes) {
|
||||
this.subscriptions[index].cancel();
|
||||
this.streams[index] = value.changes;
|
||||
this.subscriptions[index] = value.changes.listen((_) => this.ref.requestCheck());
|
||||
this.subscriptions[index] = value.changes.listen((_) => this.ref.markForCheck());
|
||||
}
|
||||
}
|
||||
return value;
|
||||
@ -236,7 +236,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||
this._createArrayToStoreObservables();
|
||||
var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; // +1 is component
|
||||
this.streams[arrayIndex] = value.changes;
|
||||
this.subscriptions[arrayIndex] = value.changes.listen((_) => this.ref.requestCheck());
|
||||
this.subscriptions[arrayIndex] = value.changes.listen((_) => this.ref.markForCheck());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@ -247,7 +247,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||
this._createArrayToStoreObservables();
|
||||
var index = this.numberOfPropertyProtoRecords + 1;
|
||||
this.streams[index] = value.changes;
|
||||
this.subscriptions[index] = value.changes.listen((_) => this.ref.requestCheck());
|
||||
this.subscriptions[index] = value.changes.listen((_) => this.ref.markForCheck());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export class ChangeDetectorRef {
|
||||
/**
|
||||
* Request to check all OnPush ancestors.
|
||||
*/
|
||||
requestCheck(): void { this._cd.markPathToRootAsCheckOnce(); }
|
||||
markForCheck(): void { this._cd.markPathToRootAsCheckOnce(); }
|
||||
|
||||
/**
|
||||
* Detaches the change detector from the change detector tree.
|
||||
@ -29,11 +29,10 @@ export class ChangeDetectorRef {
|
||||
* Reattach the change detector to the change detector tree.
|
||||
*
|
||||
* This also requests a check of this change detector. This reattached change detector will be
|
||||
*checked during the
|
||||
* next change detection run.
|
||||
* checked during the next change detection run.
|
||||
*/
|
||||
reattach(): void {
|
||||
this._cd.mode = ChangeDetectionStrategy.CheckAlways;
|
||||
this.requestCheck();
|
||||
this.markForCheck();
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class ObservableListDiff extends DefaultIterableDiffer {
|
||||
if (_subscription != null) _subscription.cancel();
|
||||
_subscription = collection.changes.listen((_) {
|
||||
_updated = true;
|
||||
_ref.requestCheck();
|
||||
_ref.markForCheck();
|
||||
});
|
||||
_updated = false;
|
||||
return super.diff(collection);
|
||||
|
@ -124,7 +124,7 @@ export class AsyncPipe implements PipeTransform, PipeOnDestroy {
|
||||
_updateLatestValue(async: any, value: Object) {
|
||||
if (async === this._obj) {
|
||||
this._latestValue = value;
|
||||
this._ref.requestCheck();
|
||||
this._ref.markForCheck();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user