Type class
An ordered list of items that dispatches events as items are added, removed or moved.
Sources
List can be used (imported) via one of the following packages.
// Import List
import * as am5 from "@amcharts/amcharts5";
// Create List
am5.List.new(root, {
// ... config if applicable
});
<!-- Load List -->
<script src="index.js"></script>
<script>
// Create List
am5.List.new(root, {
// ... config if applicable
});
</script>
Inheritance
List does not extend any other symbol.
List is extended by ListAutoDispose, Children, ListData.
Settings
List does not have any settings.
Private settings
List does not have any private settings.
Properties
|
events # |
Type Default |
|---|---|
|
length # |
Type Number of items in list. @readonly |
|
values # |
Type An array of values in the list. Don't change this array directly: use methods like @readonly |
Methods
|
[Symbol.iterator]() |
Returns Returns an ES6 iterator for the list. |
|---|---|
|
clear() |
Returns Removes all items from the list. |
|
constructor( initial: ) |
Returns Constructor |
|
contains( value: ) |
Returns Checks if list contains specific item reference. |
|
copyFrom( source: ) |
Returns Adds all items of another list to the end of this one. |
|
each( f: ( value: ) |
Returns Calls |
|
eachReverse( f: ( value: ) |
Returns Calls |
|
getIndex( index: ) |
Returns Returns an item at specified index. |
|
hasIndex( index: ) |
Returns Checks if there's a value at specific index. |
|
indexOf( value: ) |
Returns Searches the list for specific item and returns its index. |
|
insertIndex( index: ) |
Returns Inserts an item at |
|
moveValue( value: ) |
Returns Moves an item to |
|
pop() |
Returns Returns the last item from the list, and removes it. |
|
push( value: ) |
Returns Adds an item to the end of the list. |
|
pushAll( values: ) |
Returns Adds multiple items to the end of the list. |
|
removeIndex( index: ) |
Returns Removes a value at specific index. |
|
removeValue( value: ) |
Returns Removes all copies of an item from the list. |
|
setAll( newArray: ) |
Returns Replaces all items in the list with |
|
setIndex( index: ) |
Returns Replaces the value at |
|
shift() |
Returns Returns the first item from the list, and removes it. |
|
swap( a: ) |
Returns Swaps two items in the list. |
|
unshift( value: ) |
Returns Adds an item as a first item in the list. |
Events
Add event handlers to List object using its events.on() method.
Read about adding event handlers.
| #clear |
Param { oldValues: All items were removed, by |
|---|---|
| #insertIndex |
Param { index: An item was inserted at |
| #moveIndex |
Param { newIndex: An item was moved from |
| #push |
Param { newValue: An item was added to the end of the list. |
| #removeIndex |
Param { index: The item at |
| #setIndex |
Param { index: The item at |
| #swap |
Param { a: Two items swapped places. |