Maps Web SDK
Class UnitService
Extends | L.Evented |
Category | Services |
Service for store and retrieve an specific unit measurement.
This service is used by map instances, widgets and services to store their unit measurement configuration.
If its constructor receive a UnitService instance as argument it will start listen changes in the given instance and apply the same change in its own. That behavior allows the instances of this class to be updated in cascade.
Constructor
UnitService([parent])
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
parent | If is defined makes the new instance a "slave" of the given instance | No | UnitService | None |
Methods
getCurrentUnit( ): Unit
Gets currently setted unit.
Returns
setCurrentUnit([unit="metric"])
UnitService.getSupportedUnits( ): Unit[]
Static method that returns an array with the supported units.
Returns
Events
To learn more about how to listen events please refer to
this documentation.
UnitService.Events.UNIT_CHANGED
Fired after the unit is set.