About 50 results
Open links in new tab
  1. How can I avoid the boilerplate of writing “return new Promise ...

    Feb 2, 2018 · Or, if you use the Bluebird promise library, you can either promisify an individual function with Promise.promisify() or you can promisify an entire interface with Promise.promisifyAll(). Using …

  2. javascript - new Promise () vs (async () => {}) () - Stack Overflow

    Jul 27, 2019 · "the promise executor function needs to use await to get some data" - no, it doesn't. You're right to identify passing an async function as the executor to new Promise as an anitpattern. …

  3. Understanding JavaScript promise object - Stack Overflow

    Sep 13, 2016 · A promise in Javascript is an object which represent the eventual completion or failure of an asynchronous operation. Promises represent a proxy for a value which are getting in some point …

  4. What does "await new Promise ( () => {});" do? - Stack Overflow

    Oct 12, 2022 · I'm currently teaching myself Javascript/Node.js, especially the concept of a Promise and asynchronous operations. Recently while looking at some code on Github I've come across a …

  5. javascript - Creating a (ES6) promise without starting to resolve it ...

    Jun 26, 2015 · Considering exactly the question " Creating a es6 Promise without starting resolve it " I solved it creating a wrapper function and calling the wrapper function instead.

  6. javascript - Create an empty promise that just fulfills ... - Stack ...

    Jun 28, 2016 · The Promise constructor requires an executor function in its parameter. If you just need a dummy promise, then you can use Promise.resolve() instead of new Promise().

  7. javascript - How to create a new promise? - Stack Overflow

    Dec 13, 2017 · Well I understand that one would have to return a promise, and not the result of a promise to pass promises around. However I seem to be unable to implement this, say I have a …

  8. Is it an anti-pattern to use async/await inside of a new Promise ...

    150 You're effectively using promises inside the promise constructor executor function, so this is the Promise constructor anti-pattern. Your code is a good example of the main risk: not propagating all …

  9. javascript - What's the difference between returning value or Promise ...

    Dec 31, 2014 · the promise the function returned The promise resolution procedure is an abstract operation taking as input a promise and a value, which we denote as [[Resolve]](promise, x).

  10. Promise.resolve vs new Promise(resolve) - Stack Overflow

    I'm using bluebird and I see two ways to resolve synchronous functions into a Promise, but I don't get the differences between both ways. It looks like the stacktrace is a little bit different, so ...