After implementing a producer purchase we need to make sure they do the work!
Each second the producer should give us the amount of gold equal to their baseProduction.

  • Add a new field productionRate to the config object exported from constants.js.
  • Initial value of productionRate should equal to 0.
  • When the user purchases a new producer, we should increase the global productionRate
  • Implement and export a handler handleStateChange(term, state) in handlers.js that should call a function updateGold(term, state)
  • In the updateGold function, increment the value of gold by productionRate each time it’s called
  • In startMiningGame set the interval that will call handleStateChange once every second
  • handleStateChange should be a closure and return a function in order to be used in setInterval
  • Remove the call to updateGold from the handleKeyPress to avoid accounting issues

This task is part of the Full-Stack JavaScript Course.
If you have any issues with it, you can ask for community help below the post.
Feel free to help others if you’ve already solved the task.