[feat] Add progress speed field in the tauri-plugin-upload
Closed this issue · 0 comments
Describe the problem
I was creating a downloader using the tauri-plugin-upload
. I want an extra field in the event payload. Which will report the download speed of the file. This field will be updated every second.
Now, why I want this has a strong reason.
I accumulated the progress and run setInterval(() => {}, 1000)
to derive the per second download speed of the file. But, I noticed that . Javascript doesn't actually run the setInterval()
in every second consistently. Which caused the download speed to show not in a very timely manner.
Point is, setInterval
does not guarantee to run in a timely manner.
Describe the solution you'd like
My technical solution was:
- I cloned the plugin workspace.
- Created Mutex Variables And Threads.
- This thread will run every second.
- Updates the progress_speed every second.
- This progress speed will be sent alongside the event payload
Alternatives considered
No response
Additional context
I've already worked on this solution in my local machine, and it's working fine. I just wanted to ask if this feature would be accepted by the community for the tauri-plugin-upload
. Or else I'd have to create a fork of this plugin with that extra added feature ..