refactor(ChandeDetection): Rename ChangeDetectorRef.markForCheck

BREAKING CHANGE

Closes #3403

- ChangeDetectorRef.requestCheck() => ChangeDetectorRef.markForCheck()
This commit is contained in:
Misko Hevery
2015-08-28 10:08:18 -07:00
committed by Miško Hevery
parent b8be4bfaaf
commit cebd670a8e
7 changed files with 13 additions and 14 deletions

View File

@ -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;
}

View File

@ -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();
}
}