* Get data from cache (ignoring sorting) * @template R * @param {(set: SortableSet<T>) => R} fn function to calculate value * @returns {R} returns result of fn(this), cached until set changes
(fn)
| 134 | * @returns {R} returns result of fn(this), cached until set changes |
| 135 | */ |
| 136 | getFromUnorderedCache(fn) { |
| 137 | if (this._cacheOrderIndependent === undefined) { |
| 138 | this._cacheOrderIndependent = new Map(); |
| 139 | } else { |
| 140 | const result = this._cacheOrderIndependent.get(fn); |
| 141 | const data = /** @type {R} */ (result); |
| 142 | if (data !== undefined) { |
| 143 | return data; |
| 144 | } |
| 145 | } |
| 146 | const newData = fn(this); |
| 147 | this._cacheOrderIndependent.set(fn, newData); |
| 148 | return newData; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Invalidates the cached state associated with this value. |
no test coverage detected