async / await and promise



To ensure we make the correct async / await call, we still need Promises to resolve our task. Promise is like a marker that helps signified a task has been completed.

Pretty sure if you don't make use of promise, it is very unlikely that your function is awaited.

In this example, we're calling a long running external call to a service and then uses await to 'wait' for the results.

Results are then output into the console.










Comments

Popular posts from this blog

gemini cli getting file not defined error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

vllm : Failed to infer device type