Created
May 30, 2021 16:43
-
-
Save ng-the-engineer/d9ef888f0a3a7036fe4322de91f5c736 to your computer and use it in GitHub Desktop.
Code snippet of tutorial running tracker
This file contains 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 characters
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); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment