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: am4core.DictionaryTemplate */Inheritance
DictionaryTemplate extends Dictionary.
DictionaryTemplate is not extended by any other symbol.
Properties
templateType
TA "template" object to copy all properties from when creating new list items.
1 inherited item
eventsType
EventDispatcher<AMEvent<Dictionary<Key,T>,IDictionaryEvents<Key,T>>>Defaultnew EventDispatcher()Inherited fromDictionaryEvent dispatcher.
Methods
constructor(t:T)Returns
DictionaryTemplateConstructor
copyFrom(source:this)Returns
voidCopies all elements from other dictionary.
create(key:Key)Returns
TInstantiates a new object of the specified type, adds it to specified
keyin the dictionary, and returns it.
9 inherited items
[Symbol.iterator]()Returns
Iterator<...>Inherited fromDictionaryReturns an ES6 iterator for the keys/values of the dictionary.
clear()Returns
voidInherited fromDictionaryRemoves all items from the dictionary.
each(f: (key:Key, value:T) =>void)Returns
voidInherited fromDictionaryCalls
ffor each key/value in the dictionary.getKey(key:Key)Returns
Optional<T>Inherited fromDictionaryReturns the value for a specific key.
hasKey(key:Key)Returns
booleanInherited fromDictionaryReturns
trueif key exists in Dictionary.insertKey(key:Key,
value:T)Returns
voidInherited fromDictionaryInserts value at specific key.
Will thrown an exception if the key already exists in the dictionary.
iterator()Returns
Iterator<...>Inherited fromDictionaryReturns an interator that can be used to iterate through all items in the dictionary.
removeKey(key:Key)Returns
voidInherited fromDictionaryRemoves value at specific
keyfrom dictionary.setKey(key:Key,
value:T)Returns
voidInherited fromDictionaryAdds 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.
Events
5 inherited items
clearedParam { type:
"cleared", target:Dictionary}Inherited fromDictionaryInvoked when dictionary is cleared.
insertKeyParam { type:
"insertKey", target:Dictionary, key:Key, newValue:Value}Inherited fromDictionaryInvoked when
insertKey()method is called.removedParam { type:
"removed", target:Dictionary, oldValue:Value}Inherited fromDictionaryInvoked when an item is removed from the dictionary.
removeKeyParam { type:
"removeKey", target:Dictionary, key:Key, oldValue:Value}Inherited fromDictionaryInvoked when
removeKey()method is called.setKeyParam { type:
"setKey", target:Dictionary, key:Key, newValue:Value, oldValue:Value}Inherited fromDictionaryInvoked when
setKey()method is called.