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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -