this is a great article. however, there is an opinion in the dev community that we should not be using async/await as it blocks the thread. Instead we should use observables. Care to shed a light on this?
Async/await is non-blocking. They are literally a different way of writing promises, and if it help you can think of Promises as roughly equivalent to observables that are guaranteed to will only ever produce one event. They cover different use cases, but they are async.
Observables may be used to initiate promises, e.g. the classic RxJS Wikipedia search demo from MIX11, but the promise is still non-blocking
I would appreciate it if you have any links to information on this topic, in case I am misunderstanding or missing context.
this is a great article. however, there is an opinion in the dev community that we should not be using async/await as it blocks the thread. Instead we should use observables. Care to shed a light on this?
Async/await is non-blocking. They are literally a different way of writing promises, and if it help you can think of Promises as roughly equivalent to observables that are guaranteed to will only ever produce one event. They cover different use cases, but they are async.
Observables may be used to initiate promises, e.g. the classic RxJS Wikipedia search demo from MIX11, but the promise is still non-blocking
I would appreciate it if you have any links to information on this topic, in case I am misunderstanding or missing context.
Using await is what blocks the thread. I think that's what he meant
Seconding what @oculus42 said: unless there's a misunderstanding or missing context, this is still untrue.
Await is not blocking. It defers execution of subsequent code until after the awaited code completes, but it doesn't block the thread.