Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@devTea how?
This is the only way I've figured it out so far:
var gresult;
Promise().then(function(result) {gresult = result; });
return gresult; -
deodexed5736yThat's kinda the point of a promise. You don't know when the result will be available.
-
@toriyaki return will return undefined. You don't have the result until it's passed to your "then" function.
-
Promises are literally the worst implementation of "asynchronous" programming that I have ever encountered. Example:
const retrievedUserEmail: string | null = await (await userApi.getUserByEmail(email)).email
Javascript promises: I JUST WANT THE FUCKING VALUE OF A PROMISE.
WHO THE FUCK THOUGHT PROMISES SIMPLIFIED ANYTHING?!
rant
javascript