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

c# - OpenXML hanging while writing elements -

php - regexp cyrillic filename not matches -

java - IntelliJ - No such instance method -