I have a imported component, she calls a function every time that user do something (lets say press on button), in the function i must to fetch some data in async order, i would like to run the function calls as async way, the calls to the function will wait until the function is finished and then call the function again. code example- if i trigger the function 3 times fast:
hadlechange = async(type:string) => {
console.log(1111111)
let storage = await getData("G");
console.log(22222222)
await bla1();
await bla2();
console.log(333333)
await storeData('blabla');
console.log(4444444)
};
render() {
return (
<BlaBla onChange ={this.hadlechange}>)
}
Expected results
11111
22222
3333
4444
1111
2222
3333
4444
1111
2222
3333
4444
What i get
1111
1111
2222
2222
1111
3333
2222
4444
3333
3333
4444
4444
I use JavaScript- React for the client