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.

Comments:

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