Skip to content

Instantly share code, notes, and snippets.

@ng-the-engineer
Created May 30, 2021 16:43
Show Gist options
  • Save ng-the-engineer/d9ef888f0a3a7036fe4322de91f5c736 to your computer and use it in GitHub Desktop.
Save ng-the-engineer/d9ef888f0a3a7036fe4322de91f5c736 to your computer and use it in GitHub Desktop.
Code snippet of tutorial running tracker
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