UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 678 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{ResourceState as s}from"./basicInterfaces.js";class t{constructor(s,t){this._material=s,this._repository=t,this._map=new Map}dispose(){this._map.forEach(((s,t)=>{null!=s&&this._repository.release(this._material,t)}))}load(t,e,r){const i=this._material.produces.get(e);if(!i?.(r))return null;this._map.has(r)||this._map.set(r,this._repository.acquire(this._material,e,r));const a=this._map.get(r);if(null!=a){if(a.ensureResources(t)===s.LOADED)return a;this._repository.requestRender()}return null}}export{t as GLMaterials};