refactor(core): remove backwards compatibility of SimpleChange
BREAKING CHANGE: `SimnpleChange` now takes an additional argument that defines whether this is the first change or not.
This commit is contained in:
parent
db49d422f2
commit
465516b905
@ -71,15 +71,10 @@ export class ValueUnwrapper {
|
|||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export class SimpleChange {
|
export class SimpleChange {
|
||||||
constructor(
|
constructor(public previousValue: any, public currentValue: any, public firstChange: boolean) {}
|
||||||
public previousValue: any, public currentValue: any, _isFirstChange: boolean = false) {
|
|
||||||
// Store this in a non declared field
|
|
||||||
// to prevent a breaking change (users might have `implement`ed SimpleChange before)
|
|
||||||
(<any>this)._firstChange = _isFirstChange;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the new value is the first value assigned.
|
* Check whether the new value is the first value assigned.
|
||||||
*/
|
*/
|
||||||
isFirstChange(): boolean { return (<any>this)._firstChange; }
|
isFirstChange(): boolean { return this.firstChange; }
|
||||||
}
|
}
|
||||||
|
3
tools/public_api_guard/core/index.d.ts
vendored
3
tools/public_api_guard/core/index.d.ts
vendored
@ -842,8 +842,9 @@ export declare function setTestabilityGetter(getter: GetTestability): void;
|
|||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class SimpleChange {
|
export declare class SimpleChange {
|
||||||
currentValue: any;
|
currentValue: any;
|
||||||
|
firstChange: boolean;
|
||||||
previousValue: any;
|
previousValue: any;
|
||||||
constructor(previousValue: any, currentValue: any, _isFirstChange?: boolean);
|
constructor(previousValue: any, currentValue: any, firstChange: boolean);
|
||||||
isFirstChange(): boolean;
|
isFirstChange(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user