What is Promise.pending()?
See original GitHub issueNo 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:
- Created 8 years ago
- Comments:12 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks like wiki has dupe information that needs updating - https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns
pushed