UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 708 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ const t=new WeakMap;class s{constructor(s,e){switch(this._miss=0,this._hit=0,this.initialized=!0,e){case"layer":this._data=new Map;break;case"view":{const e=t.get(s);if(e){this._data=e;break}const i=new Map;this._data=i,t.set(s,i)}}}init(){return Promise.resolve()}async get(t,s){if(this._data.has(t))return this._hit++,this._data.get(t)??void 0;this._miss++}destroy(){}put(t,s){return this._data.set(t,s),Promise.resolve()}remove(t){return this._data.delete(t),Promise.resolve()}getHitRate(){return this._hit/(this._hit+this._miss)}}export{s as IDBMockCache};