UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.23 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as t}from"tslib";import s from"./Accessor.js";import o from"./Logger.js";import{debounce as r}from"./promiseUtils.js";import{initial as n}from"./reactiveUtils.js";import{property as e}from"./accessorSupport/decorators/property.js";import{subclass as i}from"./accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"./support/UpdatingHandles.js";const a=s=>{const a=s;let d=class extends a{constructor(){super(...arguments),this._updatingHandles=new p,this._numUpdating=0}get updating(){return this._numUpdating>0||this._updatingHandles.updating}destroy(){this._updatingHandles.destroy()}autoUpdateAsync(t,s){const e=r(async s=>{++this._numUpdating;try{const o=await s;this.destroyed||this._set(t,o)}catch(r){o.getLogger(this).warn(`Async update of "${String(t)}" failed. Async update functions should not throw exceptions.`)}--this._numUpdating});return this._updatingHandles.add(s,e,n)}};return t([e()],d.prototype,"_updatingHandles",void 0),t([e({readOnly:!0})],d.prototype,"updating",null),t([e()],d.prototype,"_numUpdating",void 0),d=t([i("esri.core.AsyncUpdate")],d),d},d=a(s);export{d as AsyncUpdate,a as AsyncUpdateMixin};