| nav-title | Class data/observable-array.ObservableArray |
|---|---|
| title | Class data/observable-array.ObservableArray |
| description | Class data/observable-array.ObservableArray |
Type parameters: T
Inherits: Observable
Advanced array like class used when you want to be notified when a change occurs.
- length - Number.
Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
- on( event String, callback Function... )
- event - String
- callback - Function(data EventData)
- on( event , callback Function... )
Reised when a change occurs.- event
- callback - Function(args ChangedData of T)
- getItem( index Number ) T
Returns item at specified index.- index - Number
- return - T
- setItem( index Number, value T )
Sets item at specified index.- index - Number
- value - T
- toString() String
Returns a string representation of an array.- return - String
- toLocaleString() String
- return - String
- concat( ...items Array of U ) Array of T
Types Parameters: U
Combines two or more arrays.- ...items - Array of U
Additional items to add to the end of array1. - return - Array of T
- ...items - Array of U
- concat( ...items Array of T ) Array of T
Combines two or more arrays.- ...items - Array of T
Additional items to add to the end of array1. - return - Array of T
- ...items - Array of T
- join( separator? String ) String
Adds all the elements of an array separated by the specified separator string.- separator - (optional) - String
A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - return - String
- separator - (optional) - String
- pop() T
Removes the last element from an array and returns it.- return - T
- push( items Array of T ) Number
Appends new elements to an array, and returns the new length of the array.- items - Array of T
New elements of the Array. - return - Number
- items - Array of T
- push( ...items Array of T ) Number
Appends new elements to an array, and returns the new length of the array.- ...items - Array of T
New elements of the Array. - return - Number
- ...items - Array of T
- reverse() Array of T
Reverses the elements in an Array.- return - Array of T
- shift() T
Removes the first element from an array and returns it.- return - T
- slice( start? Number, end? Number ) Array of T
Returns a section of an array.- start - (optional) - Number
The beginning of the specified portion of the array. - end - (optional) - Number
The end of the specified portion of the array. - return - Array of T
- start - (optional) - Number
- sort( compareFn? Function... ) Array of T
Sorts an array.- compareFn - (optional) - Function(a T, b T) Number
The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - return - Array of T
- compareFn - (optional) - Function(a T, b T) Number
- splice( start Number ) Array of T
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.- start - Number
The zero-based location in the array from which to start removing elements. - return - Array of T
- start - Number
- splice( start Number, deleteCount Number, ...items Array of T ) Array of T
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.- start - Number
The zero-based location in the array from which to start removing elements. - deleteCount - Number
The number of elements to remove. - ...items - Array of T
Elements to insert into the array in place of the deleted elements. - return - Array of T
- start - Number
- unshift( ...items Array of T ) Number
Inserts new elements at the start of an array.- ...items - Array of T
Elements to insert at the start of the Array. - return - Number
- ...items - Array of T
- indexOf( searchElement T, fromIndex? Number ) Number
Returns the index of the first occurrence of a value in an array.- searchElement - T
The value to locate in the array. - fromIndex - (optional) - Number
The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - return - Number
- searchElement - T
- lastIndexOf( searchElement T, fromIndex? Number ) Number
Returns the index of the last occurrence of a specified value in an array.- searchElement - T
The value to locate in the array. - fromIndex - (optional) - Number
The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - return - Number
- searchElement - T
- every( callbackfn Function..., thisArg? Object ) Boolean
Determines whether all the members of an array satisfy the specified test.- callbackfn - Function(value T, index Number, array Array of T) Boolean
A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - thisArg - (optional) - Object
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - return - Boolean
- callbackfn - Function(value T, index Number, array Array of T) Boolean
- some( callbackfn Function..., thisArg? Object ) Boolean
Determines whether the specified callback function returns true for any element of an array.- callbackfn - Function(value T, index Number, array Array of T) Boolean
A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - thisArg - (optional) - Object
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - return - Boolean
- callbackfn - Function(value T, index Number, array Array of T) Boolean
- forEach( callbackfn Function..., thisArg? Object )
Performs the specified action for each element in an array.- callbackfn - Function(value T, index Number, array Array of T)
A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - thisArg - (optional) - Object
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
- callbackfn - Function(value T, index Number, array Array of T)
- map( callbackfn Function..., thisArg? Object ) Array of U
Types Parameters: U
Calls a defined callback function on each element of an array, and returns an array that contains the results.- callbackfn - Function(value T, index Number, array Array of T) U
A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - thisArg - (optional) - Object
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - return - Array of U
- callbackfn - Function(value T, index Number, array Array of T) U
- filter( callbackfn Function..., thisArg? Object ) Array of T
Returns the elements of an array that meet the condition specified in a callback function.- callbackfn - Function(value T, index Number, array Array of T) Boolean
A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - thisArg - (optional) - Object
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - return - Array of T
- callbackfn - Function(value T, index Number, array Array of T) Boolean
- reduce( callbackfn Function..., initialValue? T ) T
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.- callbackfn - Function(previousValue T, currentValue T, currentIndex Number, array Array of T) T
A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - initialValue - (optional) - T
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - return - T
- callbackfn - Function(previousValue T, currentValue T, currentIndex Number, array Array of T) T
- reduce( callbackfn Function..., initialValue U ) U
Types Parameters: U
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.- callbackfn - Function(previousValue U, currentValue T, currentIndex Number, array Array of T) U
A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - initialValue - U
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - return - U
- callbackfn - Function(previousValue U, currentValue T, currentIndex Number, array Array of T) U
- reduceRight( callbackfn Function..., initialValue? T ) T
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.- callbackfn - Function(previousValue T, currentValue T, currentIndex Number, array Array of T) T
A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - initialValue - (optional) - T
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - return - T
- callbackfn - Function(previousValue T, currentValue T, currentIndex Number, array Array of T) T
- reduceRight( callbackfn Function..., initialValue U ) U
Types Parameters: U
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.- callbackfn - Function(previousValue U, currentValue T, currentIndex Number, array Array of T) U
A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - initialValue - U
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - return - U
- callbackfn - Function(previousValue U, currentValue T, currentIndex Number, array Array of T) U