From 465516b90536fbfa67bdda1da47a355fb4544884 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 3 Jan 2017 11:58:49 -0800 Subject: [PATCH] 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. --- .../core/src/change_detection/change_detection_util.ts | 9 ++------- tools/public_api_guard/core/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/@angular/core/src/change_detection/change_detection_util.ts b/modules/@angular/core/src/change_detection/change_detection_util.ts index 8196c1539c730..98ba03245c066 100644 --- a/modules/@angular/core/src/change_detection/change_detection_util.ts +++ b/modules/@angular/core/src/change_detection/change_detection_util.ts @@ -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) - (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 (this)._firstChange; } + isFirstChange(): boolean { return this.firstChange; } } diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index 8cf62cabb2313..b1d0a9da3163f 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -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; }