Introduced a new state.js module to hold shared state variables (currentOffset, totalDuration, lastUpdate, isPlaying).
Fixed issue where progressbar isn't functioning.
Untested as I have yet to set up my own testing environment for testing the application.
I think the progress bar wasn't updating because imported variables in ES6 modules are read-only, so updates in ui.js didn't affect the originals in api.js. There was also a TypeError from trying to assign a new value to a variable declared with const. I hopefully fixed it by creating a shared state object in state.js that both modules import and update, and by removing the const declarations when updating variables in ui.js. The progress bar should update correctly.
I also changed the polling rate from 5000 to 1000
state.js
module to hold shared state variables (currentOffset
,totalDuration
,lastUpdate
,isPlaying
).Untested as I have yet to set up my own testing environment for testing the application.
I think the progress bar wasn't updating because imported variables in ES6 modules are read-only, so updates in ui.js didn't affect the originals in api.js. There was also a TypeError from trying to assign a new value to a variable declared with const. I hopefully fixed it by creating a shared state object in state.js that both modules import and update, and by removing the const declarations when updating variables in ui.js. The progress bar should update correctly. I also changed the polling rate from 5000 to 1000