MCPcopy Create free account
hub / github.com/microsoft/SandDance / getMeasurementCache

Function getMeasurementCache

docs/app/js/sanddance-app.js:41980–41998  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41978var _utilities1 = require("@uifabric/utilities");
41979var RESIZE_DELAY = 16;
41980var getMeasurementCache = function() {
41981 var measurementsCache = {};
41982 return {
41983 /**
41984 * Checks if the provided data has a cacheKey. If it has a cacheKey and there is a
41985 * corresponding entry in the measurementsCache, then it will return that value.
41986 * Returns undefined otherwise.
41987 */ getCachedMeasurement: function(data) {
41988 if (data && data.cacheKey && measurementsCache.hasOwnProperty(data.cacheKey)) return measurementsCache[data.cacheKey];
41989 return undefined;
41990 },
41991 /**
41992 * Should be called whenever there is a new measurement associated with a given data object.
41993 * If the data has a cacheKey, store that measurement in the measurementsCache.
41994 */ addMeasurementToCache: function(data, measurement) {
41995 if (data.cacheKey) measurementsCache[data.cacheKey] = measurement;
41996 }
41997 };
41998};
41999var getNextResizeGroupStateProvider = function(measurementCache) {
42000 if (measurementCache === void 0) measurementCache = getMeasurementCache();
42001 var _measurementCache = measurementCache;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected