@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.95 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Evented.js";import e from"../../core/Logger.js";import{after as r,isAbortError as i}from"../../core/promiseUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";const l={first:!0},n={first:!1};let p=class extends o.EventedAccessor{constructor(t){super(t),this._animationController=null,this.disabled=!1,this.layout="horizontal",this.loop=!1,this.playRate=1e3,this.values=null}destroy(){this._pause()}get state(){return this._animationController?"playing":"ready"}next(){this.emit("next")}pause(){this.emit("pause"),this._pause()}play(){this.emit("play"),this._play()}previous(){this.emit("previous")}_pause(){this._animationController?.abort(),this._animationController=null}_play(){this._pause(),this._animationController=new AbortController,this._animate(l)}async _animate(t){if(this.emit("animate",t),this._animationController){try{await r(this.playRate,null,this._animationController.signal)}catch(o){return i(o)||e.getLogger(this).error(o),void this._pause()}this._animate(n)}}};t([s()],p.prototype,"_animationController",void 0),t([s({nonNullable:!0})],p.prototype,"disabled",void 0),t([s({nonNullable:!0})],p.prototype,"layout",void 0),t([s({nonNullable:!0})],p.prototype,"loop",void 0),t([s({nonNullable:!0})],p.prototype,"playRate",void 0),t([s({readOnly:!0})],p.prototype,"state",null),t([s()],p.prototype,"values",void 0),t([s()],p.prototype,"next",null),t([s()],p.prototype,"pause",null),t([s()],p.prototype,"play",null),t([s()],p.prototype,"previous",null),p=t([a("esri.widgets.ValuePicker.ValuePickerViewModel")],p);const u=p;export{u as default};