DictionaryTemplate

Type class

A version of a Dictionary 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

DictionaryTemplate can be used (imported) via one of the following packages.

/**
 * --------------------------------------------------------
 * Import from: "core.ts"
 * Use like: am4core.DictionaryTemplate
 * --------------------------------------------------------
 */
import * as am4core from "@amcharts/amcharts4/core";

/**
 * --------------------------------------------------------
 * Include via: <script src="core.js"></script>
 * Access items like: am4.DictionaryTemplate
 * --------------------------------------------------------
 */

Inheritance

DictionaryTemplate extends Dictionary.

DictionaryTemplate is not extended by any other symbol.

Properties

events
#

Type EventDispatcher < AMEvent < Dictionary < Key, T > , IDictionaryEvents < Key, T > > >

Default new EventDispatcher()

Inherited from Dictionary

Event dispatcher.

template
#

Type T

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

There is 1 inherited item currently hidden from this list.

Methods

[Symbol.iterator]()

#

Returns Iterator < ... >

Inherited from Dictionary

Returns an ES6 iterator for the keys/values of the dictionary.

clear()

#

Returns void

Inherited from Dictionary

Removes all items from the dictionary.

constructor(

t: T

)

#

Returns DictionaryTemplate

Constructor

copyFrom(

source: this

)

#

Returns void

Copies all elements from other dictionary.

create(

key: Key

)

#

Returns T

Instantiates a new object of the specified type, adds it to specified key in the dictionary, and returns it.

each(

f: ( key: Key, value: T) => void

)

#

Returns void

Inherited from Dictionary

Calls f for each key/value in the dictionary.

getKey(

key: Key

)

#

Returns Optional < T >

Inherited from Dictionary

Returns the value for a specific key.

hasKey(

key: Key

)

#

Returns boolean

Inherited from Dictionary

Returns true if key exists in Dictionary.

insertKey(

key: Key,
value: T

)

#

Returns void

Inherited from Dictionary

Inserts value at specific key.

Will thrown an exception if the key already exists in the dictionary.

iterator()

#

Returns Iterator < ... >

Inherited from Dictionary

Returns an interator that can be used to iterate through all items in the dictionary.

removeKey(

key: Key

)

#

Returns void

Inherited from Dictionary

Removes value at specific key from dictionary.

setKey(

key: Key,
value: T

)

#

Returns void

Inherited from Dictionary

Adds or updates key/value into dictionary.

If the key already exists, the old value will be overwritten.

If the new value is exactly the same as the old value (using ===), it won't do anything.

There are 9 inherited items currently hidden from this list.

Events

#cleared

Param { type: "cleared",
  target: Dictionary }

Inherited from Dictionary

Invoked when dictionary is cleared.

#insertKey

Param { key: Key,
  newValue: Value,
  type: "insertKey",
  target: Dictionary }

Inherited from Dictionary

Invoked when insertKey() method is called.

#removeKey

Param { key: Key,
  oldValue: Value,
  type: "removeKey",
  target: Dictionary }

Inherited from Dictionary

Invoked when removeKey() method is called.

#removed

Param { oldValue: Value,
  type: "removed",
  target: Dictionary }

Inherited from Dictionary

Invoked when an item is removed from the dictionary.

#setKey

Param { key: Key,
  newValue: Value,
  oldValue: Value,
  type: "setKey",
  target: Dictionary }

Inherited from Dictionary

Invoked when setKey() method is called.

There are 5 inherited items currently hidden from this list.

Adapters

DictionaryTemplate does not have any adapters.