About 51 results
Open links in new tab
  1. javascript - How do I wait for a promise to finish before returning …

    The async function will still return a promise object if called without an await (or in non asynchronous code). Check the result of console.log (waitForPromise ()) if you are uncertain.

  2. node.js - How to await a promise? - Stack Overflow

    Mar 7, 2019 · 7 It is necessary a clarification: an async return a Promise await resolve "thenable" functions, like Promise So, using the await in a callback-style can't works. This is an example …

  3. javascript - Using await within a Promise - Stack Overflow

    Jul 27, 2017 · It results in creating 2 promise objects instead of 1, uncaught errors that happen inside constructor cannot be caught with try..catch and result in unhandled rejection. …

  4. asynchronous - How to wait for a JavaScript Promise to resolve …

    Mar 8, 2015 · Because of its single-threaded model, JavaScript does not provide a wait() function out of the box; instead, the async/await keywords are the best practice. However, being …

  5. Javascript Promise with Await Explanation - Stack Overflow

    May 14, 2018 · An async function can contain an await expression that pauses the execution of the async function and waits for the passed Promise's resolution, and then resumes the async …

  6. javascript - Wait promise inside for loop - Stack Overflow

    Dec 29, 2017 · javascript node.js promise async-await bluebird asked Dec 28, 2017 at 20:36 Jumpa 4,429 12 61 105

  7. javascript - async function implicitly returns promise? - Stack …

    JavaScript's promises are trying to mimic c#'s async await behavior. However, there was a lot of structure in place historically to support that with c#, and none in JavaScript. So while in many …

  8. Javascript: Awaiting resolved promise - Stack Overflow

    Oct 15, 2020 · I would like to know, if awaiting a resolved promise, will lead to a synchronous code execution or may lead to asynchronous one. I made this little snippet to check on …

  9. How can I use async/await at the top level? - Stack Overflow

    Use top-level await (proposal, MDN; ES2022, broadly supported in modern environments) that allows top-level use of await in a module. or Use a top-level async function that never rejects …

  10. javascript - Async / await vs then which is the best for performance ...

    Feb 2, 2019 · For those saying await blocks the code until the async call returns you are missing the point. "await" is syntactic sugar for a promise.then (). It is effectively wrapping the rest of …