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: am4.SortedListTemplate
 * --------------------------------------------------------
 */

Inheritance

SortedListTemplate extends SortedList.

SortedListTemplate is not extended by any other symbol.

Properties

events
#

Type EventDispatcher < AMEvent < OrderedList < T > , ISortedListEvents < T > > >

Default new EventDispatcher()

Inherited from OrderedList

Event dispatcher.

first
#

Type T | undefined

Inherited from OrderedList

First item in the list.

last
#

Type T | undefined

Inherited from OrderedList

Last item in the list.

length
#

Type number

Inherited from OrderedList

Number of items in the list.

@readonly

template
#

Type T

A "template" object to copy all properties from when creating new list items.

values
#

Type Array < T >

Inherited from OrderedList

All items of the list.

Do not modify the list directly. Rather use insert() and remove() methods.

There are 5 inherited items currently hidden from this list.

Methods

[Symbol.iterator]()

#

Returns Iterator < T >

Inherited from OrderedList

Returns an ES6 iterator for the list.

clear()

#

Returns void

Inherited from OrderedList

Removes all items from the list.

constructor(

t: T,
sort: ( left: T, right: T) => Ordering

)

#

Returns SortedListTemplate

Constructor

contains(

value: T

)

#

Returns boolean

Inherited from OrderedList

Checks if list contains the value.

copyFrom(

source: this

)

#

Returns void

Copies all elements from other list.

create(

make: { }

)

#

Returns T

Instantiates a new object of the specified type, adds it to the end of the list, and returns it.

each(

f: ( value: T, index: number) => void

)

#

Returns void

Inherited from OrderedList

Calls f for each element in the list.

getIndex(

index: number

)

#

Returns T | undefined

Inherited from OrderedList

Returns an item at specific index.

indexOf(

value: T

)

#

Returns number

Inherited from SortedList

Returns index of the item in list if found.

-1 if item is not in the list.

insert(

value: T

)

#

Returns void

Inherited from OrderedList

Inserts a value into list.

iterator()

#

Returns Iterator < T >

Inherited from OrderedList

Returns a list iterator.

remove(

value: T

)

#

Returns void

Inherited from OrderedList

Removes an item with the value from the list.

setAll(

newArray: Array < T >

)

#

Returns void

Inherited from OrderedList

Sets multiple items to the list.

All current items are removed.

slice(

start: number,
end: number

)

#

Returns OrderedList < T >

Inherited from OrderedList

Returns part of the list between start and end indexes, as a new OrderedList.

There are 11 inherited items currently hidden from this list.

Events

#inserted

Param { index: number,
  newValue: A,
  type: "inserted",
  target: OrderedList }

Inherited from SortedList

Invoked when new value is inserted into the list.

#removed

Param { index: number,
  oldValue: A,
  type: "removed",
  target: OrderedList }

Inherited from SortedList

Invoked when a value is removed from the list.

There are 2 inherited items currently hidden from this list.

Adapters

SortedListTemplate does not have any adapters.