question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is Promise.pending()?

See original GitHub issue

No idea what the following example extracted from the doc means:

function applicationFunction(arg1) {
    var deferred = Promise.pending(); //Or Q.defer() in Q
    libraryFunction(arg1, function (err, value) {
        if (err) {
            deferred.reject(err);
        } else {
            deferred.fulfill(value);
        }
    });
    return deferred.promise;
}
  • What is Promise.pending()? what does it return? It seems it returns:
{ promise:
   Promise {
     _bitField: 0,
     _fulfillmentHandler0: undefined,
     _rejectionHandler0: undefined,
     _promise0: undefined,
     _receiver0: undefined },
  resolve: [Function: deferResolve],
  reject: [Function: deferReject] }

but that is not documented.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cchamberlaincommented, May 3, 2016

Looks like wiki has dupe information that needs updating - https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns

1reaction
petkaantonovcommented, Mar 16, 2016

pushed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my asynchronous function returning Promise ...
The promise will always log pending as long as its results are not resolved yet. You must call .then on the promise to...
Read more >
Promise <pending> - Damaris Göbel
A promise represents a single asynchronous operation that hasn't been completed yet, but is expected in the future.
Read more >
Promise Pending - Notion
Promises are objects that represent a pending/unknown value that will be resolved at a future time. Since the value Promises may represent can't...
Read more >
Async Function Returns Promise <pending> : r/learnjavascript
I'm trying to return an html string from an async function, but I keep getting "promise pending" returned. async function getTemplateHtml() ...
Read more >
An Easy Way to Understand Promise in Javascript
A promise object has three states pending , fulfilled , and rejected . I will use an analogy here. Same as the name,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found