@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.06 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../core/Logger.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as r,subclass as l}from"../core/accessorSupport/decorators.js";import s from"../portal/Portal.js";import{w as i,r as p}from"../chunks/persistableUrlUtils.js";import a from"./Symbol.js";import{Thumbnail as n}from"./support/Thumbnail.js";import{enumeration as y}from"../core/accessorSupport/decorators/enumeration.js";var m;let c=m=class extends a{constructor(t){super(t),this.color=null,this.styleName=null,this.portal=null,this.styleUrl=null,this.thumbnail=null,this.name=null,this.type="web-style"}get _fetchCacheKey(){const t=null!=this.portal?this.portal:s.getDefault(),e=t.user?t.user.username:null;return`${this.styleName}:${this.styleUrl}:${this.name}:${e}:${t.url}`}read(t,e){this.portal=e?.portal,super.read(t,e)}clone(){return new m({name:this.name,styleUrl:this.styleUrl,styleName:this.styleName,portal:this.portal})}fetchSymbol(t){return this._fetchSymbol(t)}async _fetchSymbol(t){const r=null!=t?t.cache:null,l=r?this._fetchCacheKey:null;if(null!=r){const t=l&&r.get(l);if(t)return t.clone()}const{resolveWebStyleSymbol:s}=await import("./support/webStyleSymbolUtils.js");o(t);const i=s(this,{portal:this.portal},t);i.catch(t=>{e.getLogger(this).error("#fetchSymbol()","Failed to create symbol from style",t)});const p=await i;return null!=r&&r.set(l,p.clone()),p}};t([r({json:{write:!1}})],c.prototype,"color",void 0),t([r({type:String,json:{write:!0}})],c.prototype,"styleName",void 0),t([r({type:s,json:{write:!1}})],c.prototype,"portal",void 0),t([r({type:String,json:{read:p,write:i}})],c.prototype,"styleUrl",void 0),t([r({type:n,json:{read:!1}})],c.prototype,"thumbnail",void 0),t([r({type:String,json:{write:!0}})],c.prototype,"name",void 0),t([y({styleSymbolReference:"web-style"},{readOnly:!0})],c.prototype,"type",void 0),t([r()],c.prototype,"_fetchCacheKey",null),c=m=t([l("esri.symbols.WebStyleSymbol")],c);export{c as default};