docs(API): 翻译完了 SimpleChange

This commit is contained in:
Zhicheng Wang 2018-09-05 09:22:22 +08:00
parent 7c7733c3af
commit 7b2226516a
2 changed files with 25 additions and 5 deletions

View File

@ -91,8 +91,8 @@
[x] | common/http/HTTP_INTERCEPTORS | 0.18 [x] | common/http/HTTP_INTERCEPTORS | 0.18
[x] | platform-browser/DomSanitizer | 0.18 [x] | platform-browser/DomSanitizer | 0.18
[x] | core/PipeTransform | 0.18 [x] | core/PipeTransform | 0.18
[ ] | core/SimpleChange | 0.18 [x] | core/SimpleChange | 0.18
[ ] | core/SimpleChanges | 0.18 [x] | core/SimpleChanges | 0.18
[ ] | forms/NgSelectOption | 0.17 [ ] | forms/NgSelectOption | 0.17
[ ] | common/PercentPipe | 0.17 [ ] | common/PercentPipe | 0.17
[ ] | forms/ValidatorFn | 0.17 [ ] | forms/ValidatorFn | 0.17

View File

@ -28,11 +28,17 @@ export function devModeEqual(a: any, b: any): boolean {
* Indicates that the result of a {@link Pipe} transformation has changed even though the * Indicates that the result of a {@link Pipe} transformation has changed even though the
* reference has not changed. * reference has not changed.
* *
* {@link Pipe} 使
*
* Wrapped values are unwrapped automatically during the change detection, and the unwrapped value * Wrapped values are unwrapped automatically during the change detection, and the unwrapped value
* is stored. * is stored.
* *
*
*
* Example: * Example:
* *
*
*
* ``` * ```
* if (this._latestValue === this._latestReturnedValue) { * if (this._latestValue === this._latestReturnedValue) {
* return this._latestReturnedValue; * return this._latestReturnedValue;
@ -44,33 +50,47 @@ export function devModeEqual(a: any, b: any): boolean {
* *
*/ */
export class WrappedValue { export class WrappedValue {
/** @deprecated from 5.3, use `unwrap()` instead - will switch to protected */ /** @deprecated from 5.3, use `unwrap()` instead - will switch to protected
*
* @deprecated 5.3 `unwrap()`
*/
wrapped: any; wrapped: any;
constructor(value: any) { this.wrapped = value; } constructor(value: any) { this.wrapped = value; }
/** Creates a wrapped value. */ /** Creates a wrapped value.
*
*
*/
static wrap(value: any): WrappedValue { return new WrappedValue(value); } static wrap(value: any): WrappedValue { return new WrappedValue(value); }
/** /**
* Returns the underlying value of a wrapped value. * Returns the underlying value of a wrapped value.
* Returns the given `value` when it is not wrapped. * Returns the given `value` when it is not wrapped.
*
* `value`
**/ **/
static unwrap(value: any): any { return WrappedValue.isWrapped(value) ? value.wrapped : value; } static unwrap(value: any): any { return WrappedValue.isWrapped(value) ? value.wrapped : value; }
/** Returns true if `value` is a wrapped value. */ /** Returns true if `value` is a wrapped value.
*
* `value` `true`
*/
static isWrapped(value: any): value is WrappedValue { return value instanceof WrappedValue; } static isWrapped(value: any): value is WrappedValue { return value instanceof WrappedValue; }
} }
/** /**
* Represents a basic change from a previous to a new value. * Represents a basic change from a previous to a new value.
* *
*
*/ */
export class SimpleChange { export class SimpleChange {
constructor(public previousValue: any, public currentValue: any, public firstChange: boolean) {} constructor(public previousValue: any, public currentValue: any, public firstChange: boolean) {}
/** /**
* Check whether the new value is the first value assigned. * Check whether the new value is the first value assigned.
*
*
*/ */
isFirstChange(): boolean { return this.firstChange; } isFirstChange(): boolean { return this.firstChange; }
} }