javascript - Wrapping multiple asynchronous calls into syncronous -


let's have function this

getallepisodes = (show)->    dfrd = new deferred()    eps = []    s of show.seasons       api.getmeallepisodes(s.id).done (episodes)->          eps = eps.concat(episodes)     return dfrd.promise() 

so when should resolve dfrd? can't right after loop, right? makes difficult without knowing exact number of episodes beforehand (without making api calls)


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -