@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.41 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as t}from"../../chunks/tslib.es6.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import r from"../support/PublishingInfo.js";const o=Symbol();function i(t){return null!=t&&"object"==typeof t&&o in t}const n=i=>{var n;let a=class extends i{constructor(){super(...arguments),this[n]=!0}static{n=o}get publishingInfo(){if(this.destroyed)return null;const t=this._get("publishingInfo");if(t)return t;const s=new r;return this._checkPublishingStatus(s),s}_checkPublishingStatus(t){const s=250,e=125;let r=0;const o=async s=>{let n;t.updating=!0;try{n=await this.fetchPublishingStatus()}catch(a){n="unavailable"}"published"!==n&&"unavailable"!==n||("publishing"===t.status&&this.refresh(),i.remove()),t.status=n,t.updating=!1,i.removed||(r=setTimeout(o,s,s+e))},i={removed:!1,remove(){this.removed=!0,clearTimeout(r)}};this.when().catch((()=>i.remove())),o(s),this.addHandles(i)}};return t([s({readOnly:!0,clonable:!1})],a.prototype,"publishingInfo",null),a=t([e("esri.layers.mixins.PublishableLayer")],a),a};export{n as PublishableLayer,i as isPublishableLayer};