1 year ago
#299783
AMDN
Sequential execution of 2 functions in JavaScript
I am not very familiar with async/await and promises. Currently having two individual functions - to export files from X and upload those files to Y correspondingly.
export const exportFiles = async (A: string, B: string) : Promise<void> => {
// statements to do the export
return;
};
export const uploadFiles = async (C: string, D: string) : Promise<void> => {
// statements to do the upload
return;
};
When I try to make the function calls like:
exportFiles(A, B)
uploadFiles(C, D)
uploadFiles
gets executed first since exportFiles
is a time consuming function.
How do I program the order of execution? I want uploadFiles
to start execution only after exportFiles
gets executed fully.
javascript
asynchronous
async-await
order-of-execution
0 Answers
Your Answer