@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 848 B
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
class t{constructor(t){this.moments=[],this.forwardMoments=[],this.moments.push(t)}push(t){return this.forwardMoments.length,this.moments.push(t)}pop(){if(!(this.forwardMoments.length>0))return this.moments.pop()}undo(){if(!this.canUndo())return;const t=this.moments.pop();return this.forwardMoments.push(t),t}peek(){return this.moments.at(-1)}canUndo(){return this.moments.length>1}canRedo(){return this.hasForwardEdits()}redo(){if(!this.canRedo())return;const t=this.forwardMoments.pop();return this.moments.push(t),t}size(){return this.moments.length+this.forwardMoments.length}hasForwardEdits(){return this.forwardMoments.length>0}clearForwardEdits(){this.forwardMoments=[]}}export{t as default};