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
Post a Comment