Promise Tracking
Tracking promise status at multi time-points, and cancel the process if you want.
Usage
const PromiseTracking = ;const VeryLongTask = PromiseTracking; console; ;
Will print :
At: 2.222ms
Send request.
Show loader.
At: 501.650ms
This task may take a long time.
Hide loader.
Show progress bar.
At: 2001.007ms
Server is busy.
Cancel process.
Hide progress bar.
Ask the user to try again later.
example for more case.
SeeInjecting at() to Promise class for convenience use :
const PromiseTracking = ; PromiseTracking; Promise