PublishableLayer.js 1.3 KB

12345
  1. /*
  2. All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. See https://js.arcgis.com/4.25/esri/copyright.txt for details.
  4. */
  5. import{_ as t}from"../../chunks/tslib.es6.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import r from"../support/PublishingInfo.js";const o="esri.layers.mixins.PublishableLayer",i=Symbol(o);function n(t){return t&&"object"==typeof t&&i in t}const u=i=>{let n=class extends i{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(u){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.own(i)}};return t([s({readOnly:!0,clonable:!1})],n.prototype,"publishingInfo",null),n=t([e(o)],n),n};export{u as PublishableLayer,n as isPublishableLayer};