I'm sorry that I cannot clearly describe this problem. I'll try:
Now I have one asynchronous function that takes data and does something, for example.
function myFunction(num: number):Promise<void> {
return new Promise((resolve) => {
console.log(num);
return;
});
}
I want to print 5 numbers in a group (order doesn't matter). The important thing is that I want to print the next 5 numbers after the end of the previous group. For instance:
1, 2, 5, 4, 3, 6, 9, 8, 7, 10 ... is valid
7, 10, 1, 2, 3, 4, 5, 6, 8, 9 ... is not valid
How can I do this if I need to use this function? I have to be sure that the first five calls to this function will be resolved, and then the next five functions will be called. I know this seems weird, I'm trying to distract my current problem from this number problem.
Thanks for any comments or ideas.