WrappedValue

表示 Pipe转换的值已经变化了 —— 即使其引用并没有变。

Indicates that the result of a Pipetransformation has changed even though the reference has not changed.

查看"说明"...

      
      class WrappedValue {
  static wrap(value: any): WrappedValue
  static unwrap(value: any): any
  static isWrapped(value: any): value is WrappedValue
  constructor(value: any)
  wrapped: any
}
    

说明

包装过的值会在变更检测期间自动解包,并保存解包过的值。

Wrapped values are unwrapped automatically during the change detection, and the unwrapped value is stored.

例子:

Example:

if (this._latestValue === this._latestReturnedValue) { return this._latestReturnedValue; } else { this._latestReturnedValue = this._latestValue; return WrappedValue.wrap(this._latestValue); // this will force update }
      
      if (this._latestValue === this._latestReturnedValue) {
   return this._latestReturnedValue;
 } else {
   this._latestReturnedValue = this._latestValue;
   return WrappedValue.wrap(this._latestValue); // this will force update
 }
    

静态方法

创建一个包装过的值。

Creates a wrapped value.

static wrap(value: any): WrappedValue
      
      static wrap(value: any): WrappedValue
    
参数
value any
返回值

WrappedValue

如果值(value)是包装过的,则返回它幕后的值;否则直接返回它本身。

Returns the underlying value of a wrapped value. Returns the given value when it is not wrapped.

static unwrap(value: any): any
      
      static unwrap(value: any): any
    
参数
value any
返回值

any

如果 value 是包装过的值,则返回 true

Returns true if value is a wrapped value.

static isWrapped(value: any): value is WrappedValue
      
      static isWrapped(value: any): value is WrappedValue
    
参数
value any
返回值

value is WrappedValue

构造函数

constructor(value: any)
      
      constructor(value: any)
    
参数
value any

属性

属性说明
wrapped: any