|
|
|
|
|
by skywal_l
1615 days ago
|
|
Behind async there is a real actual hardware reality. Accessing local storage (or the network) is slow and you do not want to block your UI. You say async were all over the place. Either it makes sense because fundamentally, what you are doing IS asynchronous. Or it make no sense because the asynchronous nature of you calls are not important in your design (I don't see why but ok), in that case you can always break the chains by using a promise: async bar() {
return await baz();
}
foo() {
const promise = bar();
promise.then(() => {}); // don't care...
}
|
|
If you have to chain network requests but each request depends on results of the former ones, then async/await makes it really pretty.
I have no idea how much async/await is too much.
What I do dislike is that storage loads, network requests and other things are tied to the same type, so when you look at code, you have no idea what's happening inside those async functions, but that story is for some other time.