jquery Deferred using map and apply
by colintoh
JavaScript
var coco = _.map(this.wsc.models, function(model) {
var dfd = $.Deferred();
$('#' + model.id).data('setting_url', model.get('setting_url'));
that.fetchBoxData(model, dfd);
return dfd.promise();
})
$.when.apply(null, coco).then(function() {
that.masonry(function() {
$('#dashboard').css('opacity', '1');
});
});