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:

Web Apps, SPA, PWA with vanilla Java Script (ES 6+), CSS 3 and WebStandards only. As simple as possible, but not simpler. See you at: (Progressive) Web apps, Single Page Apps and WebStandards airhacks workshops at MUC airport, Winter Edition the podcast:

Stay in touch:


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