Currently, we keep tabs on the user's location by frequently querying the browser's navigator utility in the main thread. You can find the current implementation in the entry point, app.js, of the app.
This is not a particularly resource-intensive process but should be abstracted just as the other pieces of configuration have. We could send this functionality over to the lib/ directory just as the Store and Socket listeners are configured or we could abstract it again and have a separate Web Worker polling and processing this information.
Because the process is frequently polling both device location and Google's DirectionsAPI, two external services, I think that moving this over to a Web Worker where it can run as a separate process would be the better solution. In addition, the information it provides could easily be viewed as an independent and external service so migrating that function away from our application reduces cohesion.
What do you think?
Currently, we keep tabs on the user's location by frequently querying the browser's
navigatorutility in the main thread. You can find the current implementation in the entry point, app.js, of the app.This is not a particularly resource-intensive process but should be abstracted just as the other pieces of configuration have. We could send this functionality over to the lib/ directory just as the Store and Socket listeners are configured or we could abstract it again and have a separate Web Worker polling and processing this information.
Because the process is frequently polling both device location and Google's DirectionsAPI, two external services, I think that moving this over to a Web Worker where it can run as a separate process would be the better solution. In addition, the information it provides could easily be viewed as an independent and external service so migrating that function away from our application reduces cohesion.
What do you think?