Constructor
new module:br-util /Map Factory()
This is a utility and does not need to be constructed.
Members
(inner, readonly) REMOVAL _LIMIT :int
A constant that defines the number of removals (as performed with .removeItem
) before the map is replaced
with a new one.
Type:
- int
Methods
(static) create Map()
Creates a map that doesn't leak when used in conjunction with .removeItem
.
Returns:
A specially modified map object that allows the MapFactory
to determine when any clean-up
should occur, or a normal map object for browsers that do not leak.
(static) remove Item(map ToRemove From, key ToRemove) → {Object}
Removes an item from the map.
If cleanup occurs, then the map will be replaced with a completely new one, and so any references to the map must
be reset whenever this method is called, for example:
this.m_mMap = MapFactory.removeItem(this.m_mMap, sItemKey);
Parameters:
Name | Type | Description |
---|---|---|
mapToRemoveFrom |
Object | The map the item will be removed from. |
keyToRemove |
String | The key of the item to be removed from the map. |
Returns:
A reference to the updated map — typically this will just be mapToRemoveFrom
,
but may be a new map reference if the map has been replaced with a new instance.
- Type
- Object