Giter VIP home page Giter VIP logo

gps-tracker's People

Contributors

branch-bandit avatar

Watchers

James Cloos avatar

gps-tracker's Issues

Second code review

  1. Lines 2-5 and 11-13,132: you are repeating the initialization of variables. I'd add a initializeState() or setVariablesToDefaultValues() function instead, and I'd call it every time user click START or STOP.
  2. Can you not reuse recordCoords() in recordCoordsIfMoved()?
  3. Line 60, 61 - these should be consts.
  4. onGeoFailure() - do we need isTracking check?
  5. Line 100 - ${parsedTime} can be just parsedTime.
  6. I would rewrite stopTracking() to
getLocationWithPromise()
	.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()

Preliminary code review

  1. I'd probably rename triggerCalculator() to startOrStopTracking().
  2. Instead of current contents of 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).
  3. Line 166: this line should be moved to the line 171, we don't need it for stopTracking().
  4. minDistance never gets reassigned, it's a constant, should be declared with const.
  5. I'd delete dynamicTimer and have two functions: startTimer() and stopTimer() instead.
  6. updateDynamicTimer and incrementDynamicTime don't need to be global variables.
  7. Is there some reason to use default arguments here e.g. 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);
  }
  1. Same goes for line 75 (position, arr = recordedCoords). Just delete second argument and use recordedCoords[0].
  2. Line 118 does nothing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.