JavaScript: cleaner "fetch" without "then" with "async" / "await"

The await keyword can be only used within a JavaScript async function. At the same time await allows the use of asynchronous APIs like e.g. the fetch API (useful for HTTP/JSON REST communication) in a quasi-synchronous programming style (without then method):

See you at Web (Components), MicroProfile and Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW airhacks.com workshops: MicroProfile with Quarkus and Micro Frontends with Web Components at MUC airport

airhacks.fm the podcast:

Stay in touch: airhacks.news.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
realworldpatterns.com
...the last 150 posts
...the last 10 comments
License