mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
missing setter for observable array added
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import observable = require("data/observable");
|
||||
import observableArrayDef = require("data/observable-array");
|
||||
import types = require("utils/types");
|
||||
|
||||
export class ChangeType implements observableArrayDef.ChangeType {
|
||||
static Add = "add";
|
||||
@ -66,6 +67,12 @@ export class ObservableArray<T> extends observable.Observable implements observa
|
||||
get length(): number {
|
||||
return this._array.length;
|
||||
}
|
||||
set length(value: number) {
|
||||
if (types.isNumber(value) && this._array && this._array.length !== value) {
|
||||
this._array = this._array.slice(0, value);
|
||||
this._notifyLengthChange();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of an array.
|
||||
|
Reference in New Issue
Block a user