branch-bandit / gps-tracker Goto Github PK
View Code? Open in Web Editor NEWtime and distance tracker
time and distance tracker
initializeState()
or setVariablesToDefaultValues()
function instead, and I'd call it every time user click START or STOP.recordCoords()
in recordCoordsIfMoved()
?const
s.onGeoFailure()
- do we need isTracking
check?${parsedTime}
can be just parsedTime
.stopTracking()
togetLocationWithPromise()
.then((position) => {
recordCoords(position);
getResults();
resetVariables()
})
.catch(onGeoFailure);
because it eliminates questions like 'does getResults() accept some variable returned from the recordCoords() promise'.
7. I also thing getResults()
doesn't do anything getResulty, I'd just put its contents inline in stopTracking()
.
8. You don't need the getLocation()
function, you can just use getLocationWithPromise()
triggerCalculator()
to startOrStopTracking()
.triggerCalculator()
I'd have two functions inside: startTracking()
and stopTracking()
. (showResults()
would be named stopTracking()
then, because this function's functionality includes a lot more than showing results).stopTracking()
.minDistance
never gets reassigned, it's a constant, should be declared with const.dynamicTimer
and have two functions: startTimer()
and stopTimer()
instead.updateDynamicTimer
and incrementDynamicTime
don't need to be global variables.updateDynamicTimer = (callback = incrementDynamicTime) => {
? You can write it as: updateDynamicTimer = () => {
document.getElementById("time-results").innerHTML = incrementDynamicTime(parseInt(secondsCounted/3600,10)) + ":" + incrementDynamicTime(parseInt(secondsCounted/60,10)) + ":" + incrementDynamicTime(++secondsCounted%60);
}
(position, arr = recordedCoords)
. Just delete second argument and use recordedCoords[0]
.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.