if you are allowed modifying the "sub()" function, then I think the best solution is to allow users of the function to pass a callback that would be invoked at "progress" points accordingly. Then,...