UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.6 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as s}from"tslib";import{onLocaleChange as t,fetchMessageBundle as e}from"../../intl.js";import r from"../../core/Accessor.js";import{createTask as a}from"../../core/asyncUtils.js";import{formatLength as i,formatVerticalLength as o,formatArea as m,preferredVolumePrecision as n,formatVolume as g,formatDecimal as u}from"../../core/quantityFormatUtils.js";import{formatAngleDegrees as h}from"../../core/unitFormatUtils.js";import{property as l,subclass as _}from"../../core/accessorSupport/decorators.js";let c=class extends r{constructor(s){super(s)}initialize(){this.addHandles(t(()=>this._load())),this._load()}destroy(){this._messagesTask.abort()}async when(){await this._messagesTask.promise}_load(){return null!=this._messagesTask&&this._messagesTask.abort(),this._messagesTask=a(()=>e("esri/core/t9n/Units")),this._messagesTask.promise}get _messages(){return this._messagesTask.value}formatLength(s,t,e){return this._messages?i(this._messages,s,s.unit,t,e):""}formatVerticalLength(s,t,e){return this._messages?o(this._messages,s,s.unit,t,e):""}formatArea(s,t,e){return this._messages?m(this._messages,s,s.unit,t,e):""}formatVolume(s,t,e){const r=t??n(s.unit);return this._messages?g(this._messages,s,s.unit,r,e):""}formatDecimal(s,t,e){return this._messages?u(this._messages,s,s.unit,t,e):""}formatAngleDegrees(s,t,e,r,a){return h(s,t,e,r,a)}};s([l()],c.prototype,"_messagesTask",void 0),s([l()],c.prototype,"_messages",null),c=s([_("esri.applications.Components.QuantityFormatter")],c);const p=c;export{p as default};