MCPcopy
hub / github.com/CesiumGS/cesium / set

Method set

packages/engine/Source/Core/AssociativeArray.js:68–81  ·  view source on GitHub ↗

* Associates the provided key with the provided value. If the key already * exists, it is overwritten with the new value. * * @param {string|number} key A unique identifier. * @param {T} value The value to associate with the provided key.

(key, value)

Source from the content-addressed store, hash-verified

66 * @param {T} value The value to associate with the provided key.
67 */
68 set(key, value) {
69 //>>includeStart('debug', pragmas.debug);
70 if (typeof key !== "string" && typeof key !== "number") {
71 throw new DeveloperError("key is required to be a string or number.");
72 }
73 //>>includeEnd('debug');
74
75 const oldValue = this._hash[key];
76 if (value !== oldValue) {
77 this.remove(key);
78 this._hash[key] = value;
79 this._array.push(value);
80 }
81 }
82
83 /**
84 * Retrieves the value associated with the provided key.

Callers 15

updateMethod · 0.95
handleTouchStartFunction · 0.45
handlePointerDownFunction · 0.45
combineFunction · 0.45
computePositionsExtrudedFunction · 0.45

Calls 1

removeMethod · 0.95

Tested by

no test coverage detected