Created
May 30, 2021 16:43
-
-
Save ng-the-engineer/d9ef888f0a3a7036fe4322de91f5c736 to your computer and use it in GitHub Desktop.
Revisions
-
ng-the-engineer created this gist
May 30, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ const refreshMeter = (detail) => { return new Promise((resolve) => { if (path == null) return resolve(detail); if (!isStart) return resolve(detail); const delta = calculateDelta(path._latlngs) accumulatedDistance += delta; const formattedDistance = (round(accumulatedDistance, 3)).toLocaleString('en-US', { minimumFractionDigits: 3 }) distanceBox.textContent = formattedDistance; report(`3. Updated path with ${delta} km | accumulatedDistance = ${formattedDistance}`); return resolve(detail); }) }