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
-
@olback yea and that's fucking bullshit xD
Well it isn't really like most js rants but it's so different from other languages.. -
-
@BambuSource you can just Google. There are lot of examples.
Basically instead of waiting in uncertainty, use promises.
Let's say, u want to download a image.
Create a promise for the request.
There are lifecycle methods like then,done,fail which you use to define what you do when operation is successful or failure.
Just try some basic examples.
Here's explanation from Google.
https://developers.google.com/web/... -
@BambuSource basically promises are state machines where the states represent the "readiness" of a result. There's probably some code you can find online that does what you're looking for with promises. It's a little unwieldy if you're trying to use the result in a synchronous manner unless you're using async and await.
Related Rants
Holy fuck js. And jQuery.
Your delay thingy is terrible!
rant
i hate this language
never again
delay
time
js