Class: shaka.polyfill.Map

A polyfill to provide Map.prototype.getOrInsert, Map.prototype.getOrInsertComputed, WeakMap.prototype.getOrInsert, and WeakMap.prototype.getOrInsertComputed methods.

Constructor

new Map()

A polyfill to provide Map.prototype.getOrInsert, Map.prototype.getOrInsertComputed, WeakMap.prototype.getOrInsert, and WeakMap.prototype.getOrInsertComputed methods.

Source:
See:

Methods

install()

Install the polyfill if needed.
Source:

mapGetOrInsert_(key, defaultValue) → {V}

Returns the value for the given key if present; otherwise inserts the default value, and returns that.
This:
  • (Map<K, V>|WeakMap<K, V>)
Parameters:
Name Type Description
key K
defaultValue V
Source:
Returns:
Type
V

mapGetOrInsertComputed_(key, callbackFunction) → {V}

Returns the value for the given key if present; otherwise calls the callback with the key, inserts the returned value, and returns that.
This:
  • (Map<K, V>|WeakMap<K, V>)
Parameters:
Name Type Description
key K
callbackFunction function(K): V
Source:
Returns:
Type
V