I'm implementing big file upload task. I would split a big file into hundreds promises tasks.
Promise.all([100_subtasks]).then(DO_SOMETHING)
However, Let's say there's a subtask failed or a user wants to abort the entire process manually.
How do I do?
My idea is that every subtask will do a special check on a flag.
subTask(){
// before do a upload
if (cancelFlag === true){
abort the following upload process
}
}
userClicksCancel(){
// turn the flag to true
cancelFlag = true ;
}
Thanks a lot!