Ruling out packages that help make this task easier (like Caolan McMahon’s async library), the most commonly suggested solution for sequentially resolving promises is to use (). You want the server to process a bunch of things, but not all at once, so you space the processing out over time. A trick like this is handy, for example, when you’re doing some sort of batch processing via AJAX. Sometimes, though, it needs a little help to solve some unique challenges, like when you’re trying to sequentially resolve a bunch of promises in order, one after the other. I won’t say it’s necessary, but you get the idea. It can be done, but it’s gonna be messy and you’ll probably end up burning yourself. Writing asynchronous JavaScript without using the Promise object is a lot like baking a cake with your eyes closed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |