UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 908 B
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as t}from"tslib";import s from"../core/Accessor.js";import{property as o,subclass as r}from"../core/accessorSupport/decorators.js";import{UndoInvalidError as e,ApplyInvalidError as i}from"./UndoRedoError.js";let a=class extends s{constructor(){super(...arguments),this.name="",this.tag=Symbol(),this.status=0}get canUndo(){return 1===this.status}get canRedo(){return 2===this.status}async executeUndoRedoOperation(t){switch(t){case 0:if(0!==this.status)throw new i;return await this.apply(),void(this.status=1);case 1:if(1!==this.status)throw new e;return await this.undo(),void(this.status=2);case 2:if(2!==this.status)throw new e;return await this.redo(),void(this.status=1)}}};t([o()],a.prototype,"name",void 0),t([o()],a.prototype,"tag",void 0),a=t([r("esri.undoredo.UndoableOperation")],a);export{a as UndoableOperation};