Skip to content

Commit

Permalink
refactor(core): remove backwards compatibility of SimpleChange
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
`SimnpleChange` now takes an additional argument that defines
whether this is the first change or not.
  • Loading branch information
tbosch authored and IgorMinar committed Jan 3, 2017
1 parent db49d42 commit 465516b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,10 @@ export class ValueUnwrapper {
* @stable
*/
export class SimpleChange {
constructor(
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;
}
constructor(public previousValue: any, public currentValue: any, public firstChange: boolean) {}

/**
* Check whether the new value is the first value assigned.
*/
isFirstChange(): boolean { return (<any>this)._firstChange; }
isFirstChange(): boolean { return this.firstChange; }
}
3 changes: 2 additions & 1 deletion tools/public_api_guard/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,9 @@ export declare function setTestabilityGetter(getter: GetTestability): void;
/** @stable */
export declare class SimpleChange {
currentValue: any;
firstChange: boolean;
previousValue: any;
constructor(previousValue: any, currentValue: any, _isFirstChange?: boolean);
constructor(previousValue: any, currentValue: any, firstChange: boolean);
isFirstChange(): boolean;
}

Expand Down

0 comments on commit 465516b

Please sign in to comment.