UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.47 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ class e{constructor(){this._commands=new Map,this._historicMoment=null}add(e){switch(e.type){case"override":return this._addOverride(e);case"override-by-id":return this._addOverrideById(e)}}toMessage(){const e={historicMoment:this._historicMoment,commands:{updateByIdWeak:[],updateWeak:[],removeWeak:[],update:[],remove:[],release:[]}};for(const[s,r]of this._commands.entries())switch(r.type){case"override-update-by-id":e.commands.updateByIdWeak.push(s);break;case"override-update":r.isWeak?e.commands.updateWeak.push(r.feature):e.commands.update.push(r.feature);break;case"override-remove":r.isWeak?e.commands.removeWeak.push(s):e.commands.remove.push(s);break;case"override-release":e.commands.release.push(s)}return e}_addOverrideById(e){this._historicMoment=e.historicMoment;for(const s of e.updates)this._commands.set(s,{type:"override-update-by-id",isWeak:e.isWeak});for(const s of e.removed)this._commands.set(s,{type:"override-remove",isWeak:e.isWeak})}_addOverride(e){this._historicMoment=e.historicMoment;for(const s of e.updates)this._commands.set(s.objectId,{type:"override-update",feature:s,isWeak:e.isWeak});for(const s of e.removed)this._commands.set(s,{type:"override-remove",isWeak:e.isWeak});for(const s of e.release)this._commands.set(s,{type:"override-release"})}}export{e as DebouncedFeatureOverride};