SortedListTemplate
Type class
A version of a SortedList that has a "template".
A template is an instance of an object, that can be used to create new elements in the list without actually needing to create instances for those.
When new element is created in the list, e.g. by calling its create() method, an exact copy of the element is created (including properties and other attributes), inserted into the list and returned.
Sources
SortedListTemplate can be used (imported) via one of the following packages.
/** * Import from: "core.ts" * Use like: am4core.SortedListTemplate */import * as am4core from "@amcharts/amcharts4/core";/** * Include via: <script src="core.js"></script> * Access items like: am4core.SortedListTemplate */Inheritance
SortedListTemplate extends SortedList.
SortedListTemplate is not extended by any other symbol.
Properties
templateType
TA "template" object to copy all properties from when creating new list items.
5 inherited items
eventsType
EventDispatcher<AMEvent<OrderedList<T>,ISortedListEvents<T>>>Defaultnew EventDispatcher()Inherited fromOrderedListEvent dispatcher.
firstType
T|undefinedInherited fromOrderedListFirst item in the list.
lastType
T|undefinedInherited fromOrderedListLast item in the list.
lengthType
numberInherited fromOrderedListNumber of items in the list.
valuesType
Array<T>Inherited fromOrderedListAll items of the list.
Do not modify the list directly. Rather use
insert()andremove()methods.
Methods
constructor(t:T,
sort: (left:T, right:T) =>Ordering)Returns
SortedListTemplateConstructor
copyFrom(source:this)Returns
voidCopies all elements from other list.
create(make: { })Returns
TInstantiates a new object of the specified type, adds it to the end of the list, and returns it.
11 inherited items
[Symbol.iterator]()Returns
Iterator<T>Inherited fromOrderedListReturns an ES6 iterator for the list.
clear()Returns
voidInherited fromOrderedListRemoves all items from the list.
contains(value:T)Returns
booleanInherited fromOrderedListChecks if list contains the
value.each(f: (value:T, index:number) =>void)Returns
voidInherited fromOrderedListCalls
ffor each element in the list.getIndex(index:number)Returns
T|undefinedInherited fromOrderedListReturns an item at specific
index.indexOf(value:T)Returns
numberInherited fromSortedListReturns index of the item in list if found.
-1 if item is not in the list.
insert(value:T)Returns
voidInherited fromOrderedListInserts a value into list.
iterator()Returns
Iterator<T>Inherited fromOrderedListReturns a list iterator.
remove(value:T)Returns
voidInherited fromOrderedListRemoves an item with the
valuefrom the list.setAll(newArray:Array<T>)Returns
voidInherited fromOrderedListSets multiple items to the list.
All current items are removed.
slice(start:number,
end:number)Returns
OrderedList<T>Inherited fromOrderedListReturns part of the list between
startandendindexes, as a newOrderedList.
Events
2 inherited items
insertedParam { type:
"inserted", target:OrderedList, index:number, newValue:A}Inherited fromSortedListInvoked when new value is inserted into the list.
removedParam { type:
"removed", target:OrderedList, index:number, oldValue:A}Inherited fromSortedListInvoked when a value is removed from the list.