Constructor
new module:br/util/MapFactory()
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) createMap()
-
Creates a map that doesn't leak when used in conjunction with
.removeItem
.Returns:
A specially modified map object that allows theMapFactory
to determine when any clean-up should occur, or a normal map object for browsers that do not leak. -
(static) removeItem(mapToRemoveFrom, keyToRemove) → {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 bemapToRemoveFrom
, but may be a new map reference if the map has been replaced with a new instance.- Type
- Object